Heroku:rake aborted错误

时间:2017-03-09 17:41:22

标签: ruby-on-rails ruby heroku rubygems

我无法在Heroku上安装Ruby应用程序;这是Heroku构建日志:

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.6
-----> Installing dependencies using bundler 1.13.7
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.13.7) is older than the version that created the lockfile (1.14.6). 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/.
       Installing i18n 0.8.1
       Installing rake 12.0.0
       Installing concurrent-ruby 1.0.5
       Installing minitest 5.10.1
       Installing thread_safe 0.3.6
       Installing builder 3.2.3
       Installing erubis 2.7.0
       Installing mini_portile2 2.1.0
       Installing rack 2.0.1
       Installing nio4r 2.0.0 with native extensions
       Installing websocket-extensions 0.1.2
       Installing mime-types-data 3.2016.0521
       Installing arel 7.1.4
       Installing coffee-script-source 1.12.2
       Installing execjs 2.7.0
       Installing method_source 0.8.2
       Installing thor 0.19.4
       Installing multi_json 1.12.1
       Installing puma 3.7.1 with native extensions
       Installing pg 0.19.0 with native extensions
       Using bundler 1.13.7
       Installing sass 3.4.23
       Installing tilt 2.0.6
       Installing turbolinks-source 5.0.0
       Installing tzinfo 1.2.2
       Installing nokogiri 1.7.0.1 with native extensions
       Installing rack-test 0.6.3
       Installing sprockets 3.7.1
       Installing websocket-driver 0.6.5 with native extensions
       Installing mime-types 3.1
       Installing coffee-script 2.4.1
       Installing uglifier 3.1.4
       Installing turbolinks 5.0.1
       Installing activesupport 5.0.2
       Installing mail 2.6.4
       Installing globalid 0.3.7
       Installing activemodel 5.0.2
       Installing jbuilder 2.6.3
       Installing activejob 5.0.2
       Installing activerecord 5.0.2
       Installing loofah 2.0.3
       Installing rails-dom-testing 2.0.2
       Installing rails-html-sanitizer 1.0.3
       Installing actionview 5.0.2
       Installing actionpack 5.0.2
       Installing actionmailer 5.0.2
       Installing actioncable 5.0.2
       Installing railties 5.0.2
       Installing sprockets-rails 3.2.0
       Installing coffee-rails 4.2.1
       Installing rails 5.0.2
       Installing sass-rails 5.0.6
       Installing jquery-rails 4.2.2
       Bundle complete! 16 Gemfile dependencies, 53 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Bundle completed (24.30s)
       Cleaning up the bundler cache.
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       LocalJumpError: no block given
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:389:in `instance_exec'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:389:in `eval_block'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:371:in `draw'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/config/routes.rb:1:in `<top (required)>'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/file_update_checker.rb:77:in `call'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.2/lib/active_support/file_update_checker.rb:77:in `execute'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application/finisher.rb:119:in `block in <module:Finisher>'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/config/environment.rb:5:in `<top (required)>'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application.rb:328:in `require'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application.rb:328:in `require_environment!'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/railties-5.0.2/lib/rails/application.rb:448:in `block in run_tasks_blocks'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
       /tmp/build_e32c31717ea9ea9c976885e6db22c3c9/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/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

以下是Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use sqlite3 as the database for Active Record

# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  gem 'sqlite3'

  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  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]

Routes.rb文件:

Rails.application.routes.draw do

  root "pages#home"
  get '/about', to: 'pages#about'
  get '/help', to: 'pages#help'
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

  resources :todos
end

1 个答案:

答案 0 :(得分:4)

你应该安装Heroku所需资产的gem rails_12factor:

#routes.rb
group :production do
  gem 'rails_12factor', '0.0.2'
end

创建一个生产组,使其仅在Heroku上安装。 Gem github:https://github.com/heroku/rails_12factor

为什么需要它:Why is the rails_12factor gem necessary on Heroku?