[英]Rails Error - `require': no such file to load — rubygems (LoadError)
I recently followed some instructions with RVM to install ruby-debug
and I think it might have caused some problems. 我最近按照RVM的一些说明安装了
ruby-debug
,我认为这可能会引起一些问题。 The link that I found the instructions are here: http://beginrescueend.com/support/troubleshooting/ 我找到说明的链接在这里: http : //beginrescueend.com/support/troubleshooting/
The commands I used to install are the following: 我用来安装的命令如下:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ gem install ruby-debug19 -- --with-ruby-include="${MY_RUBY_HOME/rubies/src}"
Now, when I try to start the rails server, I receive the following error: 现在,当我尝试启动rails服务器时,出现以下错误:
./bundler_stubs/rails:13:in `require': no such file to load -- rubygems (LoadError)
from ./bundler_stubs/rails:13
This SO question would lead me to believe that I have more than one version of rails installed: no such file to load -- rubygems (LoadError) 这样的问题使我相信我安装了多个版本的rails: 没有要加载的此类文件-rubygems(LoadError)
However, when I run which -a ruby
as the selected answer suggests, I only receive /usr/bin/ruby
. 但是,当我按照所选答案建议的方式运行
which -a ruby
,我只会收到/usr/bin/ruby
。 Any thoughts on what to do here? 有什么想法在这里做什么?
You need to explicitly activate the installed Ruby version before using it. 您需要在使用之前显式激活已安装的Ruby版本。
rvm use 1.9.3
which ruby
should now point to the new version. 现在
which ruby
应该指向新版本。
You can set a default Ruby version with 您可以使用以下命令设置默认的Ruby版本:
rvm --default 1.9.3
Another option is to have that Ruby version activated in your project folder. 另一个选择是在项目文件夹中激活该Ruby版本。 This can be achieved by placing a .rvmrc file there.
这可以通过在其中放置.rvmrc文件来实现。 Eg
例如
echo "rvm use 1.9.3" >> /project/folder/.rvmrc
Now you will need to install all your gems (including rubygems, rails etc.) for that particular (rvm) Ruby version, eg 现在,您将需要为该特定(rvm)Ruby版本安装所有宝石(包括rubygems,rails等),例如
gem install ruby-debug19
Try adding [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
尝试添加
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
to your .bash_profile
(if you're on a Mac) or your .bashrc
(if you're in Linux). .bash_profile
(如果使用Mac)或.bashrc
(如果使用Linux)的[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
。 Seems like your RVM path isn't being loaded, so the wrong Ruby version is being called. 似乎您的RVM路径没有被加载,因此调用了错误的Ruby版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.