简体   繁体   中英

Issue with Rails after RVM installation

I had the Rails 3.2.9 installed before I did the following.

I installed RVM using the command 'curl -L https://get.rvm.io | bash -s stable --ruby' referring https://rvm.io/rvm/install/

Then ruby 1.8.7 and 1.9.3 were installed using command rvm install [x]' ([x] stands the version) and I set ruby 1.9.3 as default using the command 'rvm use 1.9.3 --default'. Earlier I was using '1.8.7' which was installed before installing RVM. Now when I type 'rails -v' in the command prompt I am getting the following error.

/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in to_specs': Could not find railties (>= 0) amongst [bundler-1.2.3, rake-10.0.2, rubygems-bundler-1.1.0, rvm-1.11.3.5] (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in to_spec' from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:in `gem' from /usr/local/bin/rails:18

Please help me to resolve the same. Good responses will always be appreciated.

since you are using rvm you need to install rails 3.2.9 before doing rails -v try this command

gem install rails -v 3.2.9

and then try rails -v

From the Question itself it is known that the issue is with some of the gem dependencies. So after setting up RVM, I updated the gems and installed rails using gem command once again. Then restarted the terminal. Wow, It works!! 'rails -v' outputs Rails 3.2.9.

One more thing I want to tell you that if you are using bash, just execute the command '/bin/bash --login' before setting the default ruby version. Otherwise it will throw the error shown below.

'RVM is not a function, selecting rubies with 'rvm use ...' will not work.'

Thanks for all your responses.

尝试传递--default设置默认的ruby版本

rvm use 1.9.3 --default

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