【问题标题】:When deploying heroku app I get push rejected error (Precompiling assets failed)部署 heroku 应用程序时出现推送被拒绝错误(预编译资产失败)
【发布时间】:2016-04-08 16:33:49
【问题描述】:

这是我试图在 heroku 上推送的应用程序:https://github.com/kunokdev/flightmap 但是我得到了Precompiling assets failed 错误和Push rejected to ... 日志。这可能是什么原因造成的?

remote:        /tmp/build_b9c70fb95f66f6b57f7d5868507a42de/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to flightmap.
remote: 
To ssh://git@heroku.com/flightmap.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@heroku.com/flightmap.git'
kunok@Kunok:~/dev/flightmap$ 

这是我的 gemfile:

source 'https://rubygems.org'


gem 'rails', '4.2.2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# rake
gem 'rake', '11.1.2'
# csv reader
gem 'smarter_csv'
# bower rails
gem 'bower-rails'
# angular templates
gem 'angular-rails-templates'
# angular material
gem 'rails-angular-material'
# ionicons
gem 'ionicons-rails'
# Get user location info
gem 'geocoder'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
end

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

ruby "2.2.1"

【问题讨论】:

  • 我发现这个SO post 可能是相关的。
  • 试试这个RAILS_ENV=production bundle exec rake assets:precompile
  • @7urkm3n 这行得通,但现在应用程序是一个空白页面,这可能是什么问题?
  • @Kunok 我认为你在资产文件或路由方面有问题。检查一下。

标签: ruby-on-rails heroku


【解决方案1】:

正如@7urkm3n 建议的终端命令RAILS_ENV=production bundle exec rake assets:precompile 解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-19
    • 2021-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 2014-01-01
    相关资源
    最近更新 更多