Rails Ruby Gem版本发行



我对不同项目的Ruby进行了一些操作,现在当我想启动某个项目时,我有以下GEM错误:

/home/glory/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/glory/.rvm/gems/ruby-2.2.4:/home/glory/.rvm/gems/ruby-2.2.4@global', execute `gem env` for more information
    from /home/glory/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /home/glory/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /home/glory/.rbenv/versions/2.2.4/bin/rails:22:in `<main>'

当我键入gem env时,我会得到:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.10
  - RUBY VERSION: 2.2.4 (2015-12-16 patchlevel 230) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/glory/.rvm/gems/ruby-2.2.4
  - USER INSTALLATION DIRECTORY: /home/glory/.gem/ruby/2.2.0
  - RUBY EXECUTABLE: /home/glory/.rvm/rubies/ruby-2.2.4/bin/ruby
  - EXECUTABLE DIRECTORY: /home/glory/.rvm/gems/ruby-2.2.4/bin
  - SPEC CACHE DIRECTORY: /home/glory/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/glory/.rvm/rubies/ruby-2.2.4/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/glory/.rvm/gems/ruby-2.2.4
     - /home/glory/.rvm/gems/ruby-2.2.4@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/glory/.rvm/gems/ruby-2.2.4/bin
     - /home/glory/.rvm/gems/ruby-2.2.4@global/bin
     - /home/glory/.rvm/rubies/ruby-2.2.4/bin
     - /home/glory/.rvm/bin
     - /usr/local/heroku/bin
     - /home/glory/.rbenv/plugins/ruby-build/bin
     - /home/glory/.rbenv/shims
     - /home/glory/.rbenv/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

我该如何解决?

仔细查看错误日志的开始:

/home/glory/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/glory/.rvm/gems/ruby-2.2.4:/home/glory/.rvm/gems/ruby-2.2.4@global', execute `gem env` for more information

和路径信息中:

 - /home/glory/.rvm/gems/ruby-2.2.4/bin
 - /home/glory/.rvm/gems/ruby-2.2.4@global/bin
 - /home/glory/.rvm/rubies/ruby-2.2.4/bin
 - /home/glory/.rvm/bin
 - /usr/local/heroku/bin
 - /home/glory/.rbenv/plugins/ruby-build/bin
 - /home/glory/.rbenv/shims
 - /home/glory/.rbenv/bin

您正在使用RBENV和RVM。

不要那样做。

RBENV文档专门说:

兼容性注意: rbenv与RVM不兼容。请确保在安装rbenv之前完全卸载RVM并从外壳初始化文件中删除对其的任何引用。

我建议使用

删除两者
rm -rf ~/.rbenv
rvm implode

然后从您的〜/.bashrc,〜/.bash_profile和〜/.profile文件中删除其初始化行。

然后选择一个或另一个,rbenv或rvm,然后仅重新安装那个。这将迫使您重新安装您要与相关宝石一起使用的任何红宝石,但它也将干净地修复烂摊子。

我认为Ruby版本从您启动应用程序的位置会出现问题。切换到应用程序创建的其他Ruby版本。您可以使用以下版本管理器切换到不同版本

  1. rvm
  2. rbenv

用法:rvm使用{ruby-version}

相关内容

  • 没有找到相关文章

最新更新