ruby-on-rails - Heroku|Ruby 参数错误 : Missing required arguments:

标签 ruby-on-rails ruby heroku amazon-web-services

我在/config/initializers/carrier_wave.rb 中添加了 aws 访问信息:

if Rails.env.production?
  CarrierWave.configure do |config|
    config.fog_credentials = {
        # Configuration for Amazon S3
        :provider              => 'AWS',
        :aws_access_key_id     => ENV['access_key'],
        :aws_secret_access_key => ENV['secret_access_key'],
    }
    config.fog_directory     =  ENV['bucket']
  end
end

但是当我尝试推送到 heroku 时,出现以下错误:我不知道还能做什么,我们将不胜感激。

JUSTINs-iMac:premidx justindoshay$ git push heroku
Fetching repository, done.
Counting objects: 23, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (12/12), 1.09 KiB | 0 bytes/s, done.
Total 12 (delta 9), reused 0 (delta 0)

-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.3
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Using rake 10.3.2
       Using minitest 5.4.2
       Using thread_safe 0.3.4
       Using builder 3.2.2
       Using erubis 2.7.0
       Using mini_portile 0.6.1
       Using rack 1.6.0.beta
       Using i18n 0.7.0.beta1
       Using mime-types 2.4.3
       Using arel 6.0.0.beta2
       Using bcrypt 3.1.7
       Using sass 3.4.7
       Using json 1.8.1
       Using will_paginate 3.0.7
       Using thor 0.19.1
       Using cancan 1.6.10
       Using uber 0.0.10
       Using execjs 2.2.2
       Using formatador 0.2.5
       Using coffee-script-source 1.8.0
       Using excon 0.41.0
       Using net-ssh 2.9.1
       Using inflecto 0.0.2
       Using multi_json 1.10.1
       Using ipaddress 0.8.0
       Using gritter 1.1.0
       Using hike 1.2.3
       Using kgio 2.9.2
       Using pg 0.17.1
       Using bundler 1.6.3
       Using subexec 0.2.3
       Using rails_serve_static_assets 0.0.2
       Using tilt 1.4.1
       Using raindrops 0.13.0
       Using rails_stdout_logging 0.0.3
       Using tzinfo 1.2.2
       Using nokogiri 1.6.4
       Using rack-test 0.6.2
       Using rdoc 4.1.2
       Using mail 2.6.3
       Using bootstrap-will_paginate 0.0.10
       Using bootstrap-sass 3.2.0.0
       Using uglifier 2.5.3
       Using faker 1.4.2
       Using coffee-script 2.3.0
       Using net-scp 1.2.1
       Using fog-json 1.0.0
       Using mini_magick 3.8.0
       Using unicorn 4.8.3
       Using activesupport 4.2.0.beta4
       Using sprockets 2.12.3
       Using rails_12factor 0.0.2
       Using sdoc 0.4.0
       Using fog-core 1.24.0
       Using rails-deprecated_sanitizer 1.0.3
       Using globalid 0.3.0
       Using loofah 2.0.1
       Using jbuilder 2.2.3
       Using activemodel 4.2.0.beta4
       Using fog-brightbox 0.6.1
       Using fog-softlayer 0.3.23
       Using rails-dom-testing 1.0.4
       Using activejob 4.2.0.beta4
       Using rails-html-sanitizer 1.0.1
       Using activerecord 4.2.0.beta4
       Using carrierwave 0.10.0
       Using actionview 4.2.0.beta4
       Using fog 1.23.0
       Using friendly_id 5.0.4
       Using actionpack 4.2.0.beta4
       Using actionmailer 4.2.0.beta4
       Using sprockets-rails 3.0.0.beta1
       Using simple_form 3.0.2
       Using railties 4.2.0.beta4
       Using coffee-rails 4.0.1
       Using cells 3.11.2
       Using jquery-rails 4.0.0.beta2
       Using rails 4.2.0.beta4
       Using sass-rails 5.0.0.beta1
       Using turbolinks 2.3.0
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (0.79s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:237:in `validate_options'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:261:in `handle_settings'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:98:in `new'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/storage.rb:26:in `new'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:96:in `fog_credentials='
       /tmp/build_147081514681b2a6351adf453926ef97/config/initializers/carrier_wave.rb:3:in `block in <top (required)>'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:118:in `configure'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:14:in `configure'
       /tmp/build_147081514681b2a6351adf453926ef97/config/initializers/carrier_wave.rb:2:in `<top (required)>'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `block in load'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/engine.rb:648:in `block in load_config_initializer'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/notifications.rb:166:in `instrument'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/engine.rb:647:in `load_config_initializer'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/engine.rb:611:in `each'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/engine.rb:611:in `block in <class:Engine>'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:30:in `run'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:44:in `each'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:44:in `tsort_each_child'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/application.rb:349:in `initialize!'
       /tmp/build_147081514681b2a6351adf453926ef97/config/environment.rb:5:in `<top (required)>'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `block in require'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/application.rb:325:in `require_environment!'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta4/lib/rails/application.rb:438:in `block in run_tasks_blocks'
       /tmp/build_147081514681b2a6351adf453926ef97/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-3.0.0.beta1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:damp-coast-2948.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:damp-coast-2948.git'

最佳答案

确保您的环境变量已设置

你可以通过运行来做到这一点

heroku 配置

在您的终端中。

此命令将输出您当前的环境变量,如果您没有看到 ACCESS_KEYSECRET_ACCESS_KEY 然后在终端运行以下命令

heroku config:set ACCESS_KEY=YOUR_ACCESS_KEY_HERE
heroku config:set SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY_HERE

关于ruby-on-rails - Heroku|Ruby 参数错误 : Missing required arguments:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26808367/

相关文章:

ruby - 如何在 ruby​​ 中将 timeuuid 转换为时间戳

ruby-on-rails - 更新与 Rails 的多对多关系

java - 将应用程序部署到 heroku 时出错(spring boot)

ruby-on-rails - Heroku nil 类错误

ruby-on-rails - rails bundle 错误 - capybara-webkit - 无法构建 native 扩展

ruby-on-rails - 我可以在新的 Rails 应用程序中使用通用 namespace 吗?

ruby-on-rails - Google Ruby API 客户端 redirect_uri_mismatch 错误

ruby-on-rails - Nokogiri 是针对 LibXML 版本 2.7.7 构建的,但已动态加载 2.7.3

node.js - 安全 cookies node.js + Heroku + CloudFlare

ruby-on-rails - 为 nil :NilClass 获取未定义的方法 `errors'