Rails加载错误

时间:2015-05-05 02:31:00

标签: ruby-on-rails ruby rspec

只想提问。每当我有一个rails命令时,我都会遇到这种错误。即使是' rails -v'。这是错误消息:

/home/jump007/.rvm/gems/ruby-2.2.1/bin/rails:23:in `load': cannot load such file -- /home/jump007/.rvm/gems/ruby-2.2.1/gems/rails-4.2.1/bin/rails (LoadError)
    from /home/jump007/.rvm/gems/ruby-2.2.1/bin/rails:23:in `<main>'

当我尝试创建一个新的rails项目时,我也遇到了这个错误。

这是我的rails文件:

#!/home/jump007/.rvm/rubies/ruby-2.2.1/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rails' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'rails', version
load Gem.bin_path('rails', 'rails', version)

我使用RVM并且工作正常。我只使用ruby 2.2.1版本。当我安装名为rspec的新gem并且一切都变得粗糙时,错误开始了。请帮帮我

1 个答案:

答案 0 :(得分:1)

我解决了自己的问题。我刚刚卸载了rails并使用RVM重新安装了它。我想问题的原因是我安装了两个版本的rails。感谢我的直觉;)