Rails的错误 - '需要':没有这样的文件加载 - rubygems(LoadError) [英] Rails Error - `require': no such file to load -- rubygems (LoadError)
问题描述
我最近在RVM上安装了一些指令来安装 ruby-debug
,我想这可能会导致一些问题。我找到说明的链接在这里: http://beginrescueend.com/support/troubleshooting/
I recently followed some instructions with RVM to install ruby-debug
and I think it might have caused some problems. The link that I found the instructions are here: 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}"
现在,当我尝试启动rails服务器时,收到以下错误:
Now, when I try to start the rails server, I receive the following error:
./bundler_stubs/rails:13:in `require': no such file to load -- rubygems (LoadError)
from ./bundler_stubs/rails:13
这个问题会让我相信我安装了多个版本的rails:一个href =https://stackoverflow.com/questions/2896485/no-such-file-to-load-rubygems-loaderror>没有这样的文件加载 - rubygems(LoadError)
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)
然而,当我运行 whic h -a ruby
作为选定的答案建议,我只收到 / usr / bin / ruby
。任何想法在这里做什么?
However, when I run which -a ruby
as the selected answer suggests, I only receive /usr/bin/ruby
. Any thoughts on what to do here?
推荐答案
在使用它之前,您需要显式激活已安装的Ruby版本。
You need to explicitly activate the installed Ruby version before using it.
rvm use 1.9.3
ruby
现在应该指向新版本。
which ruby
should now point to the new version.
您可以使用
You can set a default Ruby version with
rvm --default 1.9.3
另一种选择是在项目文件夹中激活Ruby版本。这可以通过在那里放置一个.rvmrc文件来实现。例如:
Another option is to have that Ruby version activated in your project folder. This can be achieved by placing a .rvmrc file there. E.g.
echo "rvm use 1.9.3" >> /project/folder/.rvmrc
现在您需要安装所有宝石(包括rubygems,rails等等)为特定的(rvm)Ruby版本,例如
Now you will need to install all your gems (including rubygems, rails etc.) for that particular (rvm) Ruby version, e.g.
gem install ruby-debug19
这篇关于Rails的错误 - '需要':没有这样的文件加载 - rubygems(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!