2012-07-12 91 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