本文翻譯自:`require': no such file to load — mkmf (LoadError)
I was trying to install rails on Ubuntu Natty Narwhal 11.04, using ruby1.9.1. 我試圖使用ruby1.9.1在Ubuntu Natty Narwhal 11.04上安裝rails。
I installed ruby using apt-get install ruby1.9.1-full
which contains the dev package. 我使用apt-get install ruby1.9.1-full
安裝了ruby,其中包含dev包。 I googled the error and all have suggested I install the 1.9.1-dev which I already have. 我用Google搜索了錯誤,所有人都建議我安裝我已經擁有的1.9.1-dev。
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:36:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:36
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
#1樓
參考:https://stackoom.com/question/W53G/require-沒有要加載的文件-mkmf-LoadError
#2樓
You can use RVM(Ruby version manager) which helps in managing all versions of ruby on your machine , which is very helpful for you development (when migrating to unstable release to stable release ) 您可以使用RVM(Ruby版本管理器)來幫助您管理計算機上所有版本的ruby,這對您的開發非常有用(遷移到不穩定版本到穩定版本時)
or for Linux (ubuntu) go for sudo apt-get install ruby1.8-dev
或者對於Linux(ubuntu)去sudo apt-get install ruby1.8-dev
then sudo gem install rails
to verify it do rails -v
it will show version on rails 然後sudo gem install rails
來驗證它做rails -v
它會在rails上顯示版本
after that you can install bundles (required gems for development) 之後你可以安裝bundle(開發所需的寶石)
#3樓
This is the answer that worked for me. 這個答案對我有用。 Was in the comments above, but deserves its rightful place as answer for ubuntu 12.04 ruby 1.8.7 在上面的評論中,但作爲ubuntu 12.04 ruby 1.8.7的答案應該得到應有的地位
sudo apt-get install ruby-dev
# if above doesnt work make sure you have build essential
sudo apt-get install build-essential
#4樓
我還需要build-essential安裝:
sudo apt-get install build-essential
#5樓
The problem is still is recursive on Ubuntu 13/04/13.10/14.04 問題仍然是Ubuntu 13/04 / 13.10 / 14.04的遞歸問題
and 和
sudo apt-get install ruby1.9.1-dev
worked out for me okay. 爲我做好了沒關係。 So If you are using Ubuntu 13.04/13.10/14.04 then using this will really come in handy. 所以,如果您使用的是Ubuntu 13.04 / 13.10 / 14.04,那麼使用它將會派上用場。
This works even if ruby version is 1.9.3. 即使ruby版本是1.9.3,這也適用。 This is because there is no ruby1.9.3-dev available in the Repository... 這是因爲存儲庫中沒有可用的ruby1.9.3-dev ...
#6樓
I think is a little late but 我覺得有點晚了但是
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
worked for me on fedora. 在fedora爲我工作。
http://nokogiri.org/tutorials/installing_nokogiri.html http://nokogiri.org/tutorials/installing_nokogiri.html