简体   繁体   中英

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. 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}"

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

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)

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?

You need to explicitly activate the installed Ruby version before using it.

rvm use 1.9.3

which ruby should now point to the new version.

You can set a default Ruby version with

rvm --default 1.9.3

Another option is to have that Ruby version activated in your project folder. This can be achieved by placing a .rvmrc file there. 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

gem install ruby-debug19

Try adding [[ -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). Seems like your RVM path isn't being loaded, so the wrong Ruby version is being called.

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