简体   繁体   中英

rvm --default not setting 1.9.2 ubuntu 11.10 + can't install rails

My RVM is 1.9.2

I'm trying to set up rails. For some reason I can't. Here's what the env reports:

kevin@V130:~$ rvm list

rvm rubies

   ruby-1.8.7-p352 [ x86_64 ]
=> ruby-1.9.2-p290 [ x86_64 ]

kevin@V130:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Shouldn't that be listing 1.9.2? It's been set as the --default.

when I gem install rails I get

kevin@V130:~$ sudo gem install rails
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
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- mkmf (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from extconf.rb:1:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.6.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
kevin@V130:~$ 

You have a system install of ruby in /usr/bin that takes precedence over the rvm versions. Make sure something like ~/.rvm/rubies/your-ruby-version/bin is in your PATH environment variable before /usr/bin . When you install rvm, you should get instructions to put this:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

somewhere into a file that is sourced when starting a shell, such as ~/.bashrc .

如果您使用的是rvm,则在Ubuntu中删除现有的ruby软件包可能很有意义,至少当我按照http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and中的说明进行操作时,这是我的理解-您/

Try:

rvm use ruby-1.9.2-p290 
gem install rails

Don't use sudo gem install when you are using RVM.

Thank you, prusswan!!*

I tried installing multi-user rvm on ubuntu 11.10 but it (okay, I) was confused and kept doing single-user installs.

Finally gave up and looked at your suggestion, which led me to Joshua Frye's railsready script, which worked like a charm without rvm. I couldn't be happier. Now I have to install a database and get going with Rails.

The script is here . Works for OSX as well.

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