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. I googled the error and all have suggested I install the 1.9.1-dev which I already have.
我安装了ruby,并安装了ruby1.9.1-full,它包含了dev包。我在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
9 个解决方案
#1
966
After some search for a solution it turns out the -dev
package is needed, not just ruby1.8
. So if you have ruby1.9.1
doing
在寻找解决方案之后,需要的是-dev包,而不仅仅是ruby1.8。如果你有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.
尝试找到mkmf,看看文件是否在那里。
#2
183
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
#3
36
I also needed build-essential installed:
我还需要安装必要的安装:
sudo apt-get install build-essential
#4
30
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. This is because there is no ruby1.9.3-dev available in the Repository...
即使ruby版本是1.9.3,这也是可行的。这是因为在存储库中没有ruby1.9.3-dev。
#5
17
Have you tried:
你有试过:
sudo apt-get install ruby1.8-dev
#6
10
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
对我来说很有用,可以解决这个问题。
#7
2
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
#8
1
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。
#9
0
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安装ruby1.8-dev。
then sudo gem install rails
to verify it do rails -v
it will show version on rails
然后sudo gem安装rails来验证它是否rails -v将在rails上显示版本。
after that you can install bundles (required gems for development)
之后,您可以安装包(开发所需的gem)
#1
966
After some search for a solution it turns out the -dev
package is needed, not just ruby1.8
. So if you have ruby1.9.1
doing
在寻找解决方案之后,需要的是-dev包,而不仅仅是ruby1.8。如果你有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.
尝试找到mkmf,看看文件是否在那里。
#2
183
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
#3
36
I also needed build-essential installed:
我还需要安装必要的安装:
sudo apt-get install build-essential
#4
30
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. This is because there is no ruby1.9.3-dev available in the Repository...
即使ruby版本是1.9.3,这也是可行的。这是因为在存储库中没有ruby1.9.3-dev。
#5
17
Have you tried:
你有试过:
sudo apt-get install ruby1.8-dev
#6
10
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
对我来说很有用,可以解决这个问题。
#7
2
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
#8
1
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。
#9
0
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安装ruby1.8-dev。
then sudo gem install rails
to verify it do rails -v
it will show version on rails
然后sudo gem安装rails来验证它是否rails -v将在rails上显示版本。
after that you can install bundles (required gems for development)
之后,您可以安装包(开发所需的gem)