本文介绍了耙资产:预编译中止,不能推送到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!
无法加载此文件 - uglifier
(在/Users/me/Sites/bayani/app/assets/javascripts/admin.js中)

我以前从未将Enki博客推送到Heroku,但我不知道uglifier在哪里,但我记得在其他Enki博客中看到过我我推了,所以我不知道现在为什么会造成问题。



当我推送到Heroku并且中止了预编译时,

 为Rails资产管道准备应用程序
运行:rake资产:预编译
rake中止!
没有这样的文件加载 - uglifier
(在/tmp/build_5tbsi7k7ddhk/app/assets/javascripts/admin.js)
任务:TOP => assets:precompile:primary
(请参阅通过使用--trace运行任务完整跟踪)
预编译资产失败,启用运行时资产编译
注入rails31_enable_runtime_asset_compilation
请参阅本文以获取疑难解答帮助:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting

After阅读它提供的链接的疑难解答文章,我把它放在application.rb中。

  config.assets.initialize_on_precompile = false 

但我仍然遇到同样的问题



这是admin.js。这只是一个清单文件。这是链接enki

  //这是一个将被编译到application.js中的清单文件,它将包含下面列出的所有文件
//。
//
//此目录中的任何JavaScript / Coffee文件,lib / assets / javascripts,vendor / assets / javascripts,
//插件的vendor / assets / javascripts ,可以在这里使用相对路径来引用。
//
//在这里直接添加代码是不可取的,但如果这样做,它会出现在
//编译文件的底部。
//
//警告:第一空白行标记了要处理的内容,任何空行都应该
//在需要后执行。
//
// =需要jquery
// =需要jquery_ujs
// =需要jquery.livequery
// =需要jquery.form
// = require jquery.easing.1.3
// = require humanmsg
// = require_tree ./admin


解决方案

将以下内容添加到Gemfile中。

  group:assets 
gem'therubyracer'
gem'sass-rails',〜> 3.1.0
gem'coffee-rails',〜> 3.1.0
gem'uglifier'
end

运行



捆绑软件安装
$ b rake资产:预编译

我希望它会有用。


I'm using Enki blogging gem, it works locally, trying to prepare to push to heroku (never had a problem before). I tried to precompile and it did this

/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)

I've never had trouble pushing an Enki blog to Heroku before and, although I don't know where uglifier is, I recall having seen it in other Enki blogs I've pushed, so I don't know why it's creating problems now.

When I pushed to Heroku and it aborted the precompile as well

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

After reading the troubleshooting article at the link it provided, I put this in application.rb

config.assets.initialize_on_precompile = false

but I'm still having the same problem

This is admin.js. It's just a manifest file. this is the link to 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
解决方案

Add following to Gemfile.

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

Run

bundle install

rake assets:precompile

I hope, It will be useful .

这篇关于耙资产:预编译中止,不能推送到heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 10:29