简体   繁体   English

rvm deafult ruby​​版本正常,其他版本无效

[英]rvm deafult ruby version working other version not working

When I installed rvm it default install ruby 2.2.1 and it is working fine. 当我安装rvm时,默认安装ruby 2.2.1 ,并且工作正常。

I have installed another version rvm install 2.1.0 and installed. 我已经安装了另一个版本rvm install 2.1.0并安装了。

When I use 2.1.0 and run bundle install I get: 当我使用2.1.0并运行bundle install我得到:

/home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
    from /home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/bin/bundle:7:in `<main>'

I tried to gem install bundler give me: ERROR: While executing gem ... (NoMethodError) undefined method ord' for nil:NilClass` 我尝试用gem install bundler给我: ERROR: While executing gem ... (NoMethodError) undefined method '为nil:NilClass`

If I use ruby 2.2.1 then bundle install working. 如果我使用ruby 2.2.1,则捆绑安装工作。

when I am using rvm use 2.1.0 then which bundle give me: /usr/bin/bundle when I am using rvm use 2.2.1 then which bundle give me: /home/awlad/.rvm/gems/ruby-2.2.1/bin/bundle 当我使用rvm use 2.1.0然后which bundle rvm use 2.1.0我:/ usr / bin / bundle当我使用rvm use 2.2.1然后which bundle包给我:/home/awlad/.rvm/gems/ruby-2.2。 1 /斌/束

Here is the output of gem env : 这是gem env的输出:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.2.1 (2015-02-26 patchlevel 85) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/awlad/.rvm/gems/ruby-2.2.1
  - RUBY EXECUTABLE: /home/awlad/.rvm/rubies/ruby-2.2.1/bin/ruby
  - EXECUTABLE DIRECTORY: /home/awlad/.rvm/gems/ruby-2.2.1/bin
  - SPEC CACHE DIRECTORY: /home/awlad/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/awlad/.rvm/rubies/ruby-2.2.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/awlad/.rvm/gems/ruby-2.2.1
     - /home/awlad/.rvm/gems/ruby-2.2.1@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/awlad/.rvm/gems/ruby-2.2.1/bin
     - /home/awlad/.rvm/gems/ruby-2.2.1@global/bin
     - /home/awlad/.rvm/rubies/ruby-2.2.1/bin
     - /home/awlad/.rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

Additional info: 附加信息:

 rvm 1.26.11
 Bundler version 1.10.6

How can i solve this issue ? 我该如何解决这个问题?

When you switch from one ruby version to another using rvm and you get that message, then you should install bundler again: 当您使用rvm从一个红宝石版本切换到另一个红宝石版本并且收到该消息时,则应再次安装捆绑程序:

gem install bundler
bundle install

cannot load such file -- bundler (LoadError) This is the error. 无法加载此类文件-捆绑程序(LoadError)这是错误。 The bundler is missing for 2.1.0 . 捆绑软件缺少2.1.0。 Run gem install bundler and then bundle install 运行gem install bundler,然后捆绑安装

I am answering and accepting this question because someone may get help from this. 我正在回答并接受这个问题,因为有人可能会从中获得帮助。

After investigating I have found that it is a Ruby bug was fixed here 经过调查,我发现这是一个Ruby错误,已在此处修复

I had to upgrade ruby version to 2.1.7 to solve this issue. 我必须将ruby版本升级到2.1.7才能解决此问题。

You can get details from rvm issue tracker. 您可以从rvm问题跟踪器获取详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM