2012-07-12 75 views
4

我使用恩基博客的宝石,它在本地工作,努力准备推到Heroku的(以前从未有过的问题)。我试图预编译和它这样做耙资产:预编译中止,不能推到Heroku的

/Users/me/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby /Users/me/.rvm/gems/[email protected]/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) 

我从来没有麻烦推的恩基的博客的Heroku之前,虽然我不知道在哪里uglifier是的,我记得有其他恩基博客看到了我我推了,所以我不知道现在为什么会造成问题。

当我推到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。这只是一个清单文件。这是继以Gemfile中的链接恩基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 

回答

13

添加。

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

运行

捆绑安装

耙资产:预编译

我希望,这将是有益的。

+0

写在问题中的错误消息指出''uglifier' gem没有包含在Gemfile中的问题。所以,我只需要在Gemfile的资产组中使用'uglifier' gem。 – 2014-04-10 16:03:55