ruby-on-rails-4 - 特拉维斯 CI : The command "bundle exec rake" exited with 1

标签 ruby-on-rails-4 rake travis-ci

我的 Travis 构建遇到问题,构建失败并出现错误 命令“bundle exec rake”退出并显示 1Here is the build log来自特拉维斯。 Here is a link到 GitHub 存储库。

我尝试按照 this question 的建议将 require 'bundler' 添加到我的 Rakefile 中,但这没有任何效果。我在本地计算机上运行 bundle exec rake 没有任何问题,并且所有测试都在本地通过。

这是来自 Travis 的回溯:

    /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL:  role "app" does not exist (ActiveRecord::NoDatabaseError)
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in `new_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
    from /home/travis/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
    from /home/travis/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in `retrieve_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:87:in `connection'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:854:in `needs_migration?'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:397:in `load_schema_if_pending!'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:412:in `block in maintain_test_schema!'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:640:in `suppress_messages'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:417:in `method_missing'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:412:in `maintain_test_schema!'
    from /home/travis/build/danielbonnell/app/spec/rails_helper.rb:25:in `<top (required)>'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `block in requires='
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `each'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `requires='
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:110:in `block in process_options_into'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:109:in `each'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:109:in `process_options_into'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:22:in `configure'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:96:in `setup'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:85:in `run'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:70:in `run'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:38:in `invoke'
    from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/exe/rspec:4:in `<main>'
/home/travis/.rvm/rubies/ruby-2.0.0-p598/bin/ruby -I/home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib:/home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-support-3.2.2/lib /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
The command "bundle exec rake" exited with 1.

非常感谢任何见解。

最佳答案

事实证明,问题与我的 database.yml 文件中测试数据库的用户名有关。查看 this SO question 后,我选择不设置测试数据库的用户名。构建终于通过了。希望这对将来的人有所帮助。

关于ruby-on-rails-4 - 特拉维斯 CI : The command "bundle exec rake" exited with 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28843054/

相关文章:

macos - Octopress 运行 rake 预览失败

node.js - 通过 Travis CI API 传递 Node.JS 运行参数

javascript - 错误 : $injector:modulerr Module Error in angular

css - 如何配置 simple_form 以显示验证状态

mysql - 基于Rails Active Record中两列的组合进行查询

database - 在 Rails 应用程序上管理数据的最佳方式

ruby-on-rails - 无法激活 Rake (> 0.0.0)?

ruby-on-rails - 启动Rails环境时,有没有办法禁止Erubis打印 "** Erubis 2.6.5"?

google-app-engine - 在 Travis-CI 上运行 Google App Engine 并使用 PhantomJS 进行测试

travis-ci - 如何在 travis 上安装 libicui18n.so.52?