ruby-on-rails - rake Assets :precompile aborting, 无法推送到 heroku

标签 ruby-on-rails heroku

我正在使用 Enki 博客 gem,它在本地工作,尝试准备推送到 heroku(以前从未出现过问题)。我试图预编译,它做到了

/Users/me/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby /Users/me/.rvm/gems/ruby-1.9.3-rc1@ruby193/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
cannot load such file -- uglifier
  (in /Users/me/Sites/bayani/app/assets/javascripts/admin.js)

我以前从未在将 Enki 博客推送到 Heroku 时遇到问题,虽然我不知道 uglifier 在哪里,但我记得在我推送的其他 Enki 博客中看到过它,所以我不知道为什么它现在会产生问题.

当我推送到 Heroku 时,它也中止了预编译
Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       no such file to load -- uglifier
       (in /tmp/build_5tbsi7k7ddhk/app/assets/javascripts/admin.js)
       Tasks: TOP => assets:precompile:primary
       (See full trace by running task with --trace)
       Precompiling assets failed, enabling runtime asset compilation
       Injecting rails31_enable_runtime_asset_compilation
       Please see this article for troubleshooting help:
       http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting

在它提供的链接上阅读故障排除文章后,我把它放在 application.rb
config.assets.initialize_on_precompile = false

但我仍然有同样的问题

这是 admin.js。它只是一个 list 文件。这是 enki https://github.com/xaviershay/enki 的链接
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery.livequery
//= require jquery.form
//= require jquery.easing.1.3
//= require humanmsg
//= require_tree ./admin

最佳答案

将以下内容添加到 Gemfile。

group :assets do
  gem 'therubyracer'
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

运行

捆绑安装

耙子 Assets :预编译

我希望,它会很有用。

关于ruby-on-rails - rake Assets :precompile aborting, 无法推送到 heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11444998/

相关文章:

deployment - Heroku 推送 : gzip stdin not in gzip format

heroku - 在 Heroku 服务器上创建公钥

mysql - 未定义方法 `code' 为 nil :NilClass message with rails and a legacy database

ruby-on-rails - Ruby on Rails 链接到表单上的上一页在输入无效后失败

ruby-on-rails - 如何在 spree commerce 中创建主题

mysql - 在 Ruby on Rails 中在运行时构建表

mysql - 多对多模型之间的查询

heroku - heroku 上的谷歌分析。如何让它同时跟踪 <APPNAME>.herokuapp.com 和 <APPNAME>.com

heroku - Vanity 未在 Heroku 上使用 Redis to Go 服务器

python - Django - Heroku 中未获取静态文件