ruby-on-rails - Heroku:rake 中止错误

标签 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

最佳答案

您应该安装 Heroku Assets 所需的 gemrails_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?

关于ruby-on-rails - Heroku:rake 中止错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42702012/

相关文章:

javascript - "Uncaught TypeError: undefined is not a function"- 初学者 Backbone.js 应用程序

ruby-on-rails - Rails Vuejs Webpacker : Passing instance variable data

ruby - 如何编写归并排序?

ruby - 在 Ubuntu 上安装乘客 gem 时遇到问题

ruby-on-rails - Rails 3.2.1 Heroku Assets 预编译错误

javascript - 使用 GitLab 持续部署 NodeJS 问问题

ruby-on-rails-4 - Rack 超时 : turn off info/active logging

javascript - 自定义 rails 确认框(使用 $.rails.confirm 覆盖)

ruby-on-rails - 如何在 ruby​​ on rails 中按日期对二维数组(2d 数组)进行排序?

ruby-on-rails - 使用文本文件构建页面 (Rails 2.3)