gem命令失败,出现“错误:加载命令:install(LoadError)无法加载此类文件 - 日期”

时间:2016-09-15 13:49:33

标签: ruby macos rubygems rvm

当运行命令$ gem help install或除gemgem之外的任何其他gem help命令时,我会得到以下信息:

ERROR:  Loading command: install (LoadError)
    cannot load such file -- date
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke' for nil:NilClass

我已经在RVM定义ruby版本的目录和我的主目录中尝试了两种情况。

我尝试删除RVM并安装rbenv,但是在使用rbenv时遇到了错误,现在由于这个原因我无法让RVM再次运行。

$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/aymericbouzy/.rvm/gems/ruby-2.3.0
  - USER INSTALLATION DIRECTORY: /Users/aymericbouzy/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/aymericbouzy/.rvm/rubies/ruby-2.3.0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/aymericbouzy/.rvm/gems/ruby-2.3.0/bin
  - SPEC CACHE DIRECTORY: /Users/aymericbouzy/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/aymericbouzy/.rvm/gems/ruby-2.3.0
     - /Users/aymericbouzy/.rvm/gems/ruby-2.3.0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/aymericbouzy/.rvm/gems/ruby-2.3.0/bin
     - /Users/aymericbouzy/.rvm/gems/ruby-2.3.0@global/bin
     - /Users/aymericbouzy/.rvm/rubies/ruby-2.3.0/bin
     - /Users/aymericbouzy/.nvm/versions/node/v6.2.1/bin
     - /usr/local/sbin
     - /Users/aymericbouzy/.rbenv/shims
     - /Users/aymericbouzy/.rbenv/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /opt/local/bin
     - /opt/local/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/texbin
     - /sbin
     - /Applications/Postgres.app/Contents/Versions/latest/bin
     - /Applications/Postgres.app/Contents/Versions/latest/bin
     - /Users/aymericbouzy/.rvm/bin

使用系统ruby(gem install bundler)时命令ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]成功,但在使用项目的Gemfile中指定的ruby版本2.3.1时失败。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

从源代码安装ruby后,它对我有用: rvm install --disable-binary 2.3.1