Heroku * .js不是预编译错误

时间:2021-06-12 20:41:26

I'm using Rails on Heroku Cedar stack and it's not throwing any issues while compiling the assets but then I get a 500 internal server error:

我在Heroku Cedar堆栈上使用Rails,并且在编译资产时没有抛出任何问题,但后来我得到了500个内部服务器错误:

2012-06-25T23:22:59+00:00 app[web.1]: ActionView::Template::Error (bootstrap-datepicker.js isn't precompiled):

Any idea what might be causing this? This is the javascript file I'm including (except I downloaded it locally) https://github.com/eternicode/bootstrap-datepicker/blob/master/js/bootstrap-datepicker.js

知道是什么原因造成的吗?这是我包含的javascript文件(除了我在本地下载)https://github.com/eternicode/bootstrap-datepicker/blob/master/js/bootstrap-datepicker.js

I'm including it in my application.html.erb like so:

我将它包含在我的application.html.erb中,如下所示:

<%= javascript_include_tag "bootstrap-datepicker" %>

Is it because its not a coffeescript file? Any help is appreciated!

是因为它不是coffeescript文件吗?任何帮助表示赞赏!

1 个解决方案

#1


19  

I figured it out. I had to add it to production.rb in config.assets.precompile

我想到了。我必须将它添加到config.assets.precompile中的production.rb

In production.rb I added it to my config.assets.precompile:

在production.rb中我将它添加到我的config.assets.precompile:

config.assets.precompile += %w( jquery.dataTables.min.js jquery-ui-1.8.21.custom.min.js jquery-ui-1.8.21.custom.css bootstrap-datepicker.js fullcalendar.js)

#1


19  

I figured it out. I had to add it to production.rb in config.assets.precompile

我想到了。我必须将它添加到config.assets.precompile中的production.rb

In production.rb I added it to my config.assets.precompile:

在production.rb中我将它添加到我的config.assets.precompile:

config.assets.precompile += %w( jquery.dataTables.min.js jquery-ui-1.8.21.custom.min.js jquery-ui-1.8.21.custom.css bootstrap-datepicker.js fullcalendar.js)