简体   繁体   中英

sudo gem install rails error under ubuntu 13.04

I'm trying to set up rails with

sudo gem install rails

i'm using 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

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 :

sudo apt-get build-dep ruby rubygems rails

.. and then issue the sudo gem install rails , and it worked.

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

sudo gem install rdoc

because if you don't install rdoc first (at the time of this writing), you get this error:

file 'lib' not found

Then, finally, you can install Rails:

sudo gem install rails

and it takes a LONG time, so be patient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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