Ruby rake资产:将rails5应用程序推送到heroku时预编译失败
我用ruby 2.3.1完成我的rails5应用程序,并尝试将其推送到heroku,我收到了以下错误:Ruby rake资产:将rails5应用程序推送到heroku时预编译失败,ruby,heroku,assets,ruby-on-rails-5,Ruby,Heroku,Assets,Ruby On Rails 5,我用ruby 2.3.1完成我的rails5应用程序,并尝试将其推送到heroku,我收到了以下错误: remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be re
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1.
remote: Please use
remote: `config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=31536000' }`
remote: instead.
remote: (called from <class:Application> at /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/config/application.rb:15)
remote: rake aborted!
remote: ArgumentError: wrong number of arguments (given 2, expected 1)
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:16:in `initialize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/heroku_rails_deflate-1.0.3/lib/heroku_rails_deflate/serve_zipped_assets.rb:16:in `new'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/heroku_rails_deflate-1.0.3/lib/heroku_rails_deflate/serve_zipped_assets.rb:16:in `initialize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:35:in `new'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:35:in `build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `block in build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `each'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `inject'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:508:in `block in app'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `synchronize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `app'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/config/environment.rb:5:in `<top (required)>'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:328:in `require'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:328:in `require_environment!'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:448:in `block in run_tasks_blocks'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to cdcnv.
remote:
To https://git.heroku.com/cdcnv.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/cdcnv.git'
这是我的Gemfile
:
source 'https://rubygems.org'
ruby '2.3.1'
# Use credit_debit_card_number_validator as the default card number validator
gem 'credit_debit_card_number_validator'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '= 0.19.0.pre20160904200247'
# 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
# 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'
end
group :production do
gem 'heroku_rails_deflate'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
源代码'https://rubygems.org'
ruby“2.3.1”
#使用信用卡\借记卡\卡号\验证程序作为默认卡号验证程序
gem“信用卡\借记卡\卡号\验证器”
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem'rails','~>5.0.0','>=5.0.0.1'
#使用postgresql作为活动记录的数据库
gem'pg','=0.19.0.2015年前60904200247'
#使用Puma作为应用程序服务器
宝石“彪马”,“~>3.0”
#将SCS用于样式表
gem'sass-rails',“~>5.0”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=1.3.0'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.2”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
#宝石“therubyracer”,平台::ruby
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序的导航速度更快。阅读更多:https://github.com/turbolinks/turbolinks
gem“涡轮链接”,“大于5”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.5”
#使用Redis适配器在生产中运行操作电缆
#gem'redis',“~>3.0”
#使用ActiveModel具有\u安全\u密码
#gem'bcrypt',“~>3.1.7”
#使用Capistrano进行部署
#gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
gem'byebug',平台::mri
结束
小组:发展怎么办
#在异常页面上或通过使用代码中的任意位置访问IRB控制台。
gem‘web控制台’
结束
小组:生产部
宝石“heroku_rails_deflate”
结束
#Windows不包括zoneinfo文件,因此捆绑tzinfo数据
gem'tzinfo data',平台:[:mingw,:mswin,:x64_mingw,:jruby]
我在rails5默认应用程序中不做任何更改,只添加一个带有两个方法和一个视图的控制器,仅此而已
有什么想法吗?最后,我通过从我的
Gemfile
中删除heroku\u rails\u deflate
gem,删除Gemfile.lock
并重新运行bundle安装
来解决这个问题,然后推送到heroku
您可以从以下位置查看应用程序:
source 'https://rubygems.org'
ruby '2.3.1'
# Use credit_debit_card_number_validator as the default card number validator
gem 'credit_debit_card_number_validator'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '= 0.19.0.pre20160904200247'
# 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
# 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'
end
group :production do
gem 'heroku_rails_deflate'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]