简体   繁体   English

Rails错误-“需要”:没有要加载的此类文件-rubygems(LoadError)

[英]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.

相关问题 Rails“没有这样的文件加载 - ruby​​gems(LoadError)” - Rails “no such file to load — rubygems (LoadError)” 没有这样的文件加载 - ruby​​gems(LoadError) - no such file to load — rubygems (LoadError) Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError) - Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError) 新的Macbook-尝试运行Rails,现在我得到“在'require'中的internal:gem_prelude>:1 ::无法加载这样的文件— ruby​​gems.rb(LoadError)” - new macbook - trying to run Rails, now I get “internal:gem_prelude>:1:in `require': cannot load such file — rubygems.rb (LoadError)” 'require':没有要加载的文件— rails / cli(LoadError) - 'require': no such file to load — rails/cli (LoadError) `require':无法加载此类文件-rails / all(LoadError) - `require': cannot load such file — rails/all (LoadError) /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:在'require'中:无法加载此类文件-cassandra(LoadError) - /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file — cassandra (LoadError) Capistrano 3 rbenv问题:没有要加载的此类文件— ruby​​gems(LoadError) - Capistrano 3 rbenv issue: no such file to load — rubygems (LoadError) Rails Rspec `require': 无法加载此类文件 -- rails_helper (LoadError) - Rails Rspec `require': cannot load such file -- rails_helper (LoadError) 尝试运行 rspec 时出错:`require': 无法加载此类文件 — rails_helper (LoadError) - Error when trying to run rspec: `require': cannot load such file — rails_helper (LoadError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM