Bundler无法在管道上加载宝石

时间:2018-01-04 17:20:59

标签: ruby-on-rails bitbucket-pipelines

我使用bitbucket的管道来测试和部署我的rails应用程序。它工作正常,直到我添加了一些真正的测试,现在它给了我Bundler::GemNotFound错误,我无法找到原因。

这是我目前的bitbucket-pipelines.yml

image: ruby:2.4.3
pipelines:
  default:
    - step:
        caches:
          - bundler
        script:
          - bundle install --path vendor/bundle
          - cp config/application.example.yml config/application.yml
          - rails test -d
          - mina deploy

definitions:
  caches:
    bundler: ./vendor/bundle

Here is a gist with the raw log

我做错了什么?

修改

有关调试目的的更多信息(仅限相关部分):

宝石列表返回gems correclty

$ bundle exec gem list
rails (5.1.4)
rake (12.3.0)

但是rails命令找不到所需的宝石

$ bundle exec rails test -d
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound)
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
    from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/commands.rb:33:in `<module:Spring>'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/commands.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:87:in `preload'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
    from /opt/atlassian/pipelines/agent/build/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from -e:1:in `<main>'

1 个答案:

答案 0 :(得分:0)

我用

解决了这个问题
bundle install --binstubs