在Heroku上安装Ruby App:rake aborted。 KeyError:找不到密钥

时间:2016-05-24 15:19:34

标签: ruby heroku keyerror rakefile

这是我关于这个主题的第一篇文章,所以请保持温和,但是在运行我的应用程序rakefile时我得到了一个Keyerror。有什么想法吗?

MacBook-Pro:proleaderboard aidenhowes$ git push heroku master
Counting objects: 757, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (293/293), done.
Writing objects: 100% (757/757), 334.41 KiB | 0 bytes/s, done.
Total 757 (delta 419), reused 739 (delta 409)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path                     vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        Fetching source index from https://rubygems.org/
remote:        Fetching source index from https://rails-assets.org/
remote:        Fetching git://github.com/thoughtbot/paperclip.git
remote:        Fetching gem metadata from https://rails-assets.org/...
remote:        Fetching version metadata from https://rails-assets.org/..
remote:        Fetching git://github.com/mislav/will_paginate.git
remote:        Fetching git://github.com/bootstrap-ruby/will_paginate-    bootstrap.git
remote:        Installing rake 11.1.2
remote:        Installing concurrent-ruby 1.0.2
remote:        Installing i18n 0.7.0
remote:        Installing minitest 5.8.4
remote:        Installing thread_safe 0.3.5
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing json 1.8.3 with native extensions
remote:        Installing nio4r 1.2.1 with native extensions
remote:        Installing websocket-extensions 0.1.2
remote:        Installing mime-types-data 3.2016.0221
remote:        Installing arel 7.0.0
remote:        Installing execjs 2.6.0
remote:        Installing json_pure 1.8.3
remote:        Installing bcrypt 3.1.11 with native extensions
remote:        Installing sass 3.4.22
remote:        Installing callsite 0.0.11
remote:        Installing chartkick 1.5.2
remote:        Installing coffee-script-source 1.10.0
remote:        Installing method_source 0.8.2
remote:        Installing thor 0.19.1
remote:        Installing orm_adapter 0.5.0
remote:        Installing multi_xml 0.5.5
remote:        Installing multi_json 1.12.0
remote:        Installing turbolinks-source 5.0.0.beta4
remote:        Installing mimemagic 0.3.1
remote:        Using bundler 1.11.2
remote:        Installing puma 3.4.0 with native extensions
remote:        Installing rails-assets-tether 1.3.2
remote:        Installing pg 0.18.4 with native extensions
remote:        Installing rails_serve_static_assets 0.0.5
remote:        Installing rails_stdout_logging 0.0.5
remote:        Using will_paginate 3.1.0 from git://github.com/mislav/will_paginate.git (at master@5d92ee2)
remote:        Installing tilt 2.0.2
remote:        Installing yard 0.8.7.6
remote:        Installing faker 1.6.3
remote:        Installing tzinfo 1.2.2
remote:        Installing nokogiri 1.6.7.2 with native extensions
remote:        Installing websocket-driver 0.6.3 with native extensions
remote:        Installing mime-types 3.0
remote:        Installing autoprefixer-rails 6.3.6
remote:        Installing uglifier 3.0.0
remote:        Installing jmespath 1.2.4
remote:        Installing coffee-script 2.4.1
remote:        Installing rack 2.0.0.rc1
remote:        Installing httparty 0.13.7
remote:        Installing turbolinks 5.0.0.beta2
remote:        Installing rails_12factor 0.0.3
remote:        Installing activesupport 5.0.0.rc1
remote:        Using will_paginate-bootstrap 1.0.1 from git://github.com/bootstrap-ruby/will_paginate-bootstrap.git (at master@5fb4867)
remote:        Installing bootstrap 4.0.0.alpha3
remote:        Installing mail 2.6.4
remote:        Installing aws-sdk-core 2.3.4
remote:        Installing warden 1.2.6
remote:        Installing rack-test 0.6.3
remote:        Installing rack-contrib 1.2.0
remote:        Installing rails-deprecated_sanitizer 1.0.3
remote:        Installing sprockets 3.6.0
remote:        Installing globalid 0.3.6
remote:        Installing activemodel 5.0.0.rc1
remote:        Installing climate_control 0.0.3
remote:        Installing groupdate 2.5.3
remote:        Installing jbuilder 2.4.1
remote:        Installing loofah 2.0.3
remote:        Installing aws-sdk-resources 2.3.4
remote:        Installing rails-dom-testing 1.0.7
remote:        Installing activejob 5.0.0.rc1
remote:        Installing activerecord 5.0.0.rc1
remote:        Installing cocaine 0.5.8
remote:        Using paperclip 5.0.0.beta2 from git://github.com/thoughtbot/paperclip.git (at master@2c59f96)
remote:        Installing rails-html-sanitizer 1.0.3
remote:        Installing aws-sdk 2.3.4
remote:        Installing actionview 5.0.0.rc1
remote:        Installing actionpack 5.0.0.rc1
remote:        Installing actionmailer 5.0.0.rc1
remote:        Installing actioncable 5.0.0.rc1
remote:        Installing railties 5.0.0.rc1
remote:        Installing sprockets-rails 3.0.4
remote:        Installing responders 2.2.0
remote:        Installing coffee-rails 4.1.1
remote:        Installing font-awesome-rails 4.6.2.0
remote:        Installing jquery-turbolinks 2.1.0
remote:        Installing jquery-rails 4.1.1
remote:        Installing meta_request 0.4.0
remote:        Installing jquery-ui-rails 5.0.5
remote:        Installing rails 5.0.0.rc1
remote:        Installing sass-rails 5.0.4
remote:        Installing devise 4.0.2
remote:        Bundle complete! 38 Gemfile dependencies, 89 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Post-install message from httparty:
remote:        When you HTTParty, you must party hard!
remote:        Post-install message from paperclip:
remote:        ##################################################
remote:        #  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER       #
remote:        ##################################################
remote:        Paperclip is now compatible with aws-sdk >= 2.0.0.
remote:        If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
remote:        changes:
remote:        * You must set the `s3_region`
remote:        * If you are explicitly setting permissions anywhere, such as in an initializer,
remote:        note that the format of the permissions changed from using an underscore to
remote:        using a hyphen. For example, `:public_read` needs to be changed to
remote:        `public-read`.
remote:        For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
remote:        http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
remote:        Bundle completed (54.79s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        KeyError: key not found: "S3_BUCKET_NAME"
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:92:in `fetch'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:92:in `block in <top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/railtie.rb:209:in `instance_eval'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/railtie.rb:209:in `configure'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:1:in `<top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `block in require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:259:in `load_dependency'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:599:in `each'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:599:in `block in <class:Engine>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:55:in `block in run_initializers'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:44:in `each'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:44:in `tsort_each_child'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:54:in `run_initializers'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:352:in `initialize!'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environment.rb:5:in `<top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `block in require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:259:in `load_dependency'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:328:in `require_environment!'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:448:in `block in run_tasks_blocks'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to proleaderboard.
remote: 
To https://git.heroku.com/proleaderboard.git
! [remote rejected] master -> master (pre-receive hook declined)

1 个答案:

答案 0 :(得分:1)

您需要在Heroku上设置heroku config:set S3_BUCKET_NAME=name_of_bucket环境变量。

在CUI上你可以Settings

在GUI上,您可以转到Heroku应用的Reveal Config Vars标签和{{1}},并保存您需要的任何变量。

我建议在CUI上设置变量,因为我遇到了某些变量以某种方式未加载的问题,并且在CUI上重新设置变量解决了问题。