Rails找不到宝石。 "在任何来源中找不到.."

时间:2016-05-18 14:45:00

标签: ruby-on-rails ruby ruby-on-rails-3 rubygems bundler

我最近使用rbenv设置了Ruby on Rails。但由于某种原因,我得到了:"无法在任何来源中找到shoulda-matchers-3.1.1"当我尝试做一个rails生成脚手架命令。这是我的宝石环境:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.4
  - RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY:     /home/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /home/username/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /home/username/.rbenv/versions/2.3.0/bin/ruby
  - EXECUTABLE DIRECTORY: /home/username/.rbenv/versions/2.3.0/bin
  - SPEC CACHE DIRECTORY: /home/username/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/username/.rbenv/versions/2.3.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
     - /home/username/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
 - https://rubygems.org/
  - SHELL PATH:
     - /home/username/.rbenv/versions/2.3.0/bin
     - /home/username/.rbenv/libexec
     - /home/username/.rbenv/plugins/ruby-build/bin
     - /home/username/.rbenv/plugins/ruby-build/bin
     - /home/username/.rbenv/shims
     - /home/username/.rbenv/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /home/username/.rvm/bin
     - /home/username/.rvm/bin
     - /home/username/.rvm/bin

当我运行gem list时,它会显示:

sass-rails (5.0.4)
sdoc (0.4.1)
shoulda-matchers (3.1.1)
spring (1.7.1)
sprockets (3.6.0)

我已经尝试过gem install shoulda-matcher,捆绑安装,捆绑更新,gem安装捆绑,gem安装捆绑,gem更新 - 系统等等。它说我已经拥有它但它仍然一直给我这个错误。请帮忙。 d:

1 个答案:

答案 0 :(得分:1)

您可能需要每次为bundle exec添加bundle exec rails g前缀,例如bundle exec

如果您因输入bundle install --binstubs 而生病,可以安装binstubs,如

https://github.com/alonsoir/awesome-recommendation-engine/tree/develop

有关详细信息,请参阅https://github.com/rbenv/rbenv/wiki/Plugins#bundler-integration