简体   繁体   English

ubuntu 13.04下的sudo gem install rails错误

[英]sudo gem install rails error under ubuntu 13.04

I'm trying to set up rails with 我正在尝试设置rails

sudo gem install rails

i'm using rvm 我正在使用rvm

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

i'm getting many errors currently using ruby 2.0 我目前使用ruby 2.0收到很多错误

any help how to solve this error. 任何帮助如何解决此错误。

I had the same problem, so i did previously an installation of build dependencies for ruby , rubygems and rails : 我遇到了同样的问题,所以我之前安装了rubyrubygemsrails的构建依赖项:

sudo apt-get build-dep ruby rubygems rails

.. and then issue the sudo gem install rails , and it worked. ..然后发出sudo gem install rails ,它成功了。

Use this command 使用此命令

$ \curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails

after this check if any requirements left by 在检查之后,是否还有任何要求

rvm requirements

Some extra detail. 一些额外的细节。 I had to do things in this order: 我必须按以下顺序进行操作:

sudo apt-get build-dep ruby rubygems rails

then I had to install rdoc 然后我不得不安装rdoc

sudo gem install rdoc

because if you don't install rdoc first (at the time of this writing), you get this error: 因为如果不先安装rdoc(在撰写本文时),则会出现此错误:

file 'lib' not found

Then, finally, you can install Rails: 然后,最后,您可以安装Rails:

sudo gem install rails

and it takes a LONG time, so be patient. 这需要很长时间,所以请耐心等待。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM