首页 > 解决方案 > 在 Heroku 上加载应用程序时出错

问题描述

当我运行 git push heroku master 命令时,出现错误:未能将 somerefs 推送到“ https://git.heroku.com/cafeteria-jetruby.git ”。在我计算机上的本地版本中,该程序可以正常运行。当我安装carrierwave gem时出现了问题。请告诉我问题是什么以及在哪里查找错误?

载波配置中的设置如下

if Rails.env.production?
  CarrierWave.configure do |config|
    config.fog_credentials = {
        provider:                  'AWS',
        aws_access_key_id:     ENV['S3_ACCESS_KEY'],
        aws_secret_access_key: ENV['S3_SECRET_KEY']
    }

    config.fog_directory = ENV['S3_BUCKET_NAME']
  end
end

应用程序日志

!     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby,Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.7
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Fetching gem metadata from https://rubygems.org/.........
       Fetching version metadata from https://rubygems.org/..
       Fetching dependency metadata from https://rubygems.org/.
       Fetching rake 12.3.1
       Fetching concurrent-ruby 1.0.5
       Fetching minitest 5.11.3
       Installing minitest 5.11.3
       Installing rake 12.3.1
       Installing concurrent-ruby 1.0.5
       Fetching thread_safe 0.3.6
       Installing thread_safe 0.3.6
       Fetching builder 3.2.3
       Installing builder 3.2.3
       Fetching erubi 1.7.1
       Installing erubi 1.7.1
       Fetching mini_portile2 2.3.0
       Fetching crass 1.0.4
       Installing mini_portile2 2.3.0
       Fetching rack 2.0.5
       Installing crass 1.0.4
       Fetching nio4r 2.3.1
       Installing rack 2.0.5
       Installing nio4r 2.3.1 with native extensions
       Fetching websocket-extensions 0.1.3
       Installing websocket-extensions 0.1.3
       Fetching mini_mime 1.0.0
       Installing mini_mime 1.0.0
       Fetching arel 8.0.0
       Installing arel 8.0.0
       Fetching bcrypt 3.1.12
       Installing bcrypt 3.1.12 with native extensions
       Using bundler 1.15.2
       Fetching mime-types-data 3.2016.0521
       Installing mime-types-data 3.2016.0521
       Fetching climate_control 0.2.0
       Installing climate_control 0.2.0
       Fetching coffee-script-source 1.12.2
       Installing coffee-script-source 1.12.2
       Fetching execjs 2.7.0
       Installing execjs 2.7.0
       Fetching method_source 0.9.0
       Installing method_source 0.9.0
       Fetching thor 0.20.0
       Installing thor 0.20.0
       Fetching orm_adapter 0.5.0
       Installing orm_adapter 0.5.0
       Fetching excon 0.62.0
       Installing excon 0.62.0
       Fetching ffi 1.9.23
       Installing ffi 1.9.23 with native extensions
       Fetching formatador 0.2.5
       Installing formatador 0.2.5
       Fetching multi_json 1.13.1
       Installing multi_json 1.13.1
       Fetching ipaddress 0.8.3
       Installing ipaddress 0.8.3
       Fetching mimemagic 0.3.2
       Installing mimemagic 0.3.2
       Fetching mini_magick 4.8.0
       Installing mini_magick 4.8.0
       Fetching pg 1.0.0
       Installing pg 1.0.0 with native extensions
       Fetching puma 3.11.4
       Installing puma 3.11.4 with native extensions
       Fetching rb-fsevent 0.10.3
       Installing rb-fsevent 0.10.3
       Fetching tilt 2.0.8
       Installing tilt 2.0.8
       Fetching turbolinks-source 5.1.0
       Installing turbolinks-source 5.1.0
       Fetching i18n 1.0.1
       Installing i18n 1.0.1
       Fetching tzinfo 1.2.5
       Installing tzinfo 1.2.5
       Fetching nokogiri 1.8.2
       Installing nokogiri 1.8.2 with native extensions
       Fetching websocket-driver 0.6.5
       Installing websocket-driver 0.6.5 with native extensions
       Fetching mail 2.7.0
       Installing mail 2.7.0
       Fetching rack-test 1.0.0
       Installing rack-test 1.0.0
       Fetching warden 1.2.7
       Installing warden 1.2.7
       Fetching sprockets 3.7.1
       Installing sprockets 3.7.1
       Fetching mime-types 3.1
       Installing mime-types 3.1
       Fetching cocaine 0.5.8
       Installing cocaine 0.5.8
       Fetching coffee-script 2.4.1
       Installing coffee-script 2.4.1
       Fetching uglifier 4.1.10
       Installing uglifier 4.1.10
       Fetching rb-inotify 0.9.10
       Installing rb-inotify 0.9.10
       Fetching turbolinks 5.1.1
       Installing turbolinks 5.1.1
       Fetching activesupport 5.1.6
       Installing activesupport 5.1.6
       Fetching fog-core 2.1.0
       Installing fog-core 2.1.0
       Fetching sass-listen 4.0.0
       Installing sass-listen 4.0.0
       Fetching globalid 0.4.1
       Installing globalid 0.4.1
       Fetching activemodel 5.1.6
       Installing activemodel 5.1.6
       Fetching jbuilder 2.7.0
       Installing jbuilder 2.7.0
       Fetching fog-json 1.1.0
       Installing fog-json 1.1.0
       Fetching sass 3.5.6
       Installing sass 3.5.6
       Fetching activejob 5.1.6
       Installing activejob 5.1.6
       Fetching activerecord 5.1.6
       Installing activerecord 5.1.6
       Fetching carrierwave 1.2.2
       Installing carrierwave 1.2.2
       Fetching paperclip 5.2.1
       Installing paperclip 5.2.1
       Fetching rails-dom-testing 2.0.3
       Fetching loofah 2.2.2
       Installing rails-dom-testing 2.0.3
       Installing loofah 2.2.2
       Fetching fog-xml 0.1.3
       Installing fog-xml 0.1.3
       Fetching rails-html-sanitizer 1.0.4
       Fetching fog-aws 3.0.0
       Installing rails-html-sanitizer 1.0.4
       Fetching actionview 5.1.6
       Installing actionview 5.1.6
       Installing fog-aws 3.0.0
       Fetching actionpack 5.1.6
       Installing actionpack 5.1.6
       Fetching actioncable 5.1.6
       Fetching actionmailer 5.1.6
       Installing actioncable 5.1.6
       Installing actionmailer 5.1.6
       Fetching railties 5.1.6
       Fetching sprockets-rails 3.2.1
       Installing sprockets-rails 3.2.1
       Installing railties 5.1.6
       Fetching simple_form 4.0.1
       Installing simple_form 4.0.1
       Fetching coffee-rails 4.2.2
       Fetching responders 2.4.0
       Installing coffee-rails 4.2.2
       Installing responders 2.4.0
       Fetching jquery-ui-rails 6.0.1
       Fetching rails 5.1.6
       Installing rails 5.1.6
       Fetching sass-rails 5.0.7
       Installing jquery-ui-rails 6.0.1
       Installing sass-rails 5.0.7
       Fetching devise 4.4.3
       Installing devise 4.4.3
       Bundle complete! 25 Gemfile dependencies, 78 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Post-install message from paperclip:
       ##################################################
       #  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER      #
       ##################################################

       Paperclip is now compatible with aws-sdk >= 2.0.0.

       If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
       changes:

       * You must set the `s3_region`
       * If you are explicitly setting permissions anywhere, such as in an initializer,
         note that the format of the permissions changed from using an underscore to
         using a hyphen. For example, `:public_read` needs to be changed to
         `public-read`.

       For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
       http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
       Bundle completed (32.18s)
       Cleaning up the bundler cache.
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       LoadError: cannot load such file -- fog
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:122:in `eager_load_fog'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:137:in `fog_credentials='
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/config/initializers/carriervawe.rb:3:in `block in <top (required)>'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:159:in `configure'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave.rb:14:in `configure'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/config/initializers/carriervawe.rb:2:in `<top (required)>'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:655:in `block in load_config_initializer'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/notifications.rb:168:in `instrument'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:654:in `load_config_initializer'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:611:in `each'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:611:in `block in <class:Engine>'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `each'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `tsort_each_child'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/config/environment.rb:5:in `<top (required)>'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:445:in `block in run_tasks_blocks'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
       /tmp/build_bedb5e2c296a47ff2369b0d19d1fe3cf/vendor/bundle/ruby/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

和我的宝石文件

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.1.6'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'jquery-ui-rails'
gem 'devise', '~> 4.2'
gem 'carrierwave', '~> 1.2', '>= 1.2.2'
gem 'mini_magick', '~> 4.8'
gem 'simple_form'
gem 'fog-aws'

group :development, :test do
  gem 'sqlite3'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
  gem 'rspec-rails', '~> 3.7', '>= 3.7.2'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :production do
  gem 'pg'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

标签: ruby-on-railsheroku

解决方案


推荐阅读