简体   繁体   English

安装RVM后Rails出现问题

[英]Issue with Rails after RVM installation

I had the Rails 3.2.9 installed before I did the following. 在执行以下操作之前,我已经安装了Rails 3.2.9。

I installed RVM using the command 'curl -L https://get.rvm.io | 我使用命令'curl -L https://get.rvm.io |安装了RVM。 bash -s stable --ruby' referring https://rvm.io/rvm/install/ bash -s stable --ruby'指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'. 然后使用命令rvm install [x]'([x]代表版本)安装ruby 1.8.7和1.9.3,我使用命令'rvm use 1.9.3 --default'将ruby 1.9.3设置为默认值。 Earlier I was using '1.8.7' which was installed before installing RVM. 之前我使用的是“ 1.8.7”,它是在安装RVM之前安装的。 Now when I type 'rails -v' in the command prompt I am getting the following error. 现在,当我在命令提示符下键入“ rails -v”时,出现以下错误。

/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 /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:在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来自/usr/lib/ruby/vendor_ruby/1.8 /rubygems.rb:1208:在来自/ usr / local / bin / rails:18的'gem'中

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 由于您使用的是rvm,因此需要在安装rails -v之前先安装rails 3.2.9

gem install rails -v 3.2.9

and then try rails -v 然后尝试rails -v

From the Question itself it is known that the issue is with some of the gem dependencies. 从问题本身可以知道问题出在某些gem依赖项上。 So after setting up RVM, I updated the gems and installed rails using gem command once again. 因此,设置RVM之后,我再次使用gem命令更新了gems并安装了rails。 Then restarted the terminal. 然后重启终端。 Wow, It works!! 哇,行得通! 'rails -v' outputs Rails 3.2.9. 'rails -v'输出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. 我想告诉您的另一件事是,如果您使用的是bash,只需在设置默认的ruby版本之前执行命令'/ bin / bash --login'。 Otherwise it will throw the error shown below. 否则会引发如下所示的错误。

'RVM is not a function, selecting rubies with 'rvm use ...' will not work.' “ RVM不是功能,选择带有“ rvm use ...”的红宝石将不起作用。”

Thanks for all your responses. 感谢您的所有回复。

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

rvm use 1.9.3 --default

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

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