ruby-on-rails-3 – 部署到heroku资产管道Sprockets :: fileNotFound

前端之家收集整理的这篇文章主要介绍了ruby-on-rails-3 – 部署到heroku资产管道Sprockets :: fileNotFound前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图将我的应用程序部署到Heroku. Heroku没有加载我的js和css文件

我运行RAILS_ENV =生产包执行rake资产:预编译
它仍然没有工作.

然后我跑了
英雄耙资产:预编译

我在Heroku日志中收到此错误

Error compiling asset application.css:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/stylesheets/application.css.scss:13)

Served asset /application-989f5e5266d9b066eb316183d7db5c77.css - 500 Internal Server Error


 Error compiling asset application.js:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/javascripts/application.js:16)
Served asset /application-d81c946c6f47242e5e97de9bca4938be.js - 500 Internal Server Error

config production.rb:

config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true
  config.assets.compile = true
  config.assets.initialize_on_precompile = false

  config.assets.digest = true

资产
application.css.scss

*= require_self
 *= require bootstrap_and_overrides
 *= require jquery.ui.datepicker
 *= require bootstrap-timepicker
 *= require jquery.fileupload-ui
 *= require_tree .
*/

的application.js

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require jquery.ui.datepicker
//= require bootstrap-timepicker
//= require jquery-fileupload/basic
//= require jquery-fileupload/vendor/tmpl
//= require_tree .

任何想法如何解决这个问题?提前感谢所有的帮助.

解决方法

我相信这个问题与未被预编译的资产有关.

在你的终端,如果你运行:

$>>> rake assets:precompile

然后做你的添加和提交:

$>>> git add .
$>>> git commit -m 'Added precompiled assets for Heroku'

假设你的遥控器叫做“heroku”:

$>>> git push heroku master

它应该正确部署,而不必弄乱你的应用程序.

猜你在找的Ruby相关文章