[英]`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。 I googled the error and all have suggested I install the 1.9.1-dev which I already have.我用谷歌搜索了错误,所有人都建议我安装我已经拥有的 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
After some search for a solution it turns out the -dev
package is needed, not just ruby1.8
.经过一番搜索解决方案后,发现需要
-dev
包,而不仅仅是ruby1.8
。 So if you have ruby1.9.1
doing所以如果你有
ruby1.9.1
sudo apt-get install ruby1.9.1-dev
or to install generic ruby version, use (as per @lamplightdev comment):或安装通用 ruby 版本,使用(根据@lamplightdev 评论):
sudo apt-get install ruby-dev
should fix it.应该修复它。
Try locate mkmf
to see if the file is actually there.尝试
locate mkmf
以查看该文件是否确实存在。
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
我还需要安装 build-essential:
sudo apt-get install build-essential
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 可用...
你有没有尝试过:
sudo apt-get install ruby1.8-dev
I got the similar error when install bundle安装包时出现类似错误
sudo apt-get install ruby-dev
Works great for me and solve the problem Mint 16 ruby1.9.3非常适合我并解决问题 Mint 16 ruby1.9.3
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
You've Ruby 1.8 so you need to upgrade to at least 1.9 to make it working.您使用的是 Ruby 1.8,因此您至少需要升级到 1.9 才能使其正常工作。
If so, then check How to install a specific version of a ruby gem?如果是这样,请检查如何安装特定版本的 ruby gem?
If this won't help, then reinstalling ruby-dev
again.如果这没有帮助,请再次重新安装
ruby-dev
。
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)之后,您可以安装捆绑包(开发所需的宝石)
Ruby version: 2.7.1 gem version: 3.1.3 Ruby 版本:2.7.1 宝石版本:3.1.3
You need to check the extension that could not be installed, and find the reasons.您需要检查无法安装的扩展,并找出原因。
Read the mkmf.log file showed at the installation error under "To see why this extension failed to compile, please check the mkmf.log which can be found here" , perhaps there is a missing lib ( sometimes iconv ), and you must install it.阅读在安装错误下显示的mkmf.log文件“要了解为什么此扩展无法编译,请检查可以在此处找到的 mkmf.log” ,也许缺少 lib(有时是 iconv ),您必须安装它。
You can search the extension with your package manager(apt, yum, pacman...) too.您也可以使用包管理器(apt、yum、pacman...)搜索扩展。
gem install rails
Showed me:给我看了:
To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/user/.gem/ruby/2.7.0/extensions/x86_64-linux/2.7.0/ nokogiri -1.10.9/mkmf.log
要知道为什么这个扩充功能无法编译,请检查可以在这里找到mkmf.log:/home/user/.gem/ruby/2.7.0/extensions/x86_64-linux/2.7.0/引入nokogiri -1.10.9 /mkmf.log
Go to: https://aur.archlinux.org/packages/ruby-nokogiri/前往: https : //aur.archlinux.org/packages/ruby-nokogiri/
make
installedmake
git clone
the package git clone
包cd
to package cd
打包makepkg
the package makepkg
包Hope to help!希望有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.