本文翻译自:`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