ActionView :: Template :: Error(highcharts.js未预编译):

时间:2012-08-08 21:09:18

标签: ruby-on-rails heroku actionview

我在heroku上的应用显示了这个错误:

ActionView::Template::Error (highcharts.js isn't precompiled):

我尝试了两种我在互联网上找到的解决方案

config.assets.initialize_on_precompile = false

config.assets.compile = true

我读了一篇帖子(我不记得是哪一篇)并用这个命令创建了de heroku:

heroku create --stack cedar

当我运行heroku时,我也遇到了这个错误:

enter image description here

这是我的heroku日志

....
2012-08-08T21:03:41+00:00 app[web.1]: ActionView::Template::Error (highcharts.js isn't precompiled):
2012-08-08T21:03:41+00:00 app[web.1]: 
2012-08-08T21:03:41+00:00 app[web.1]:     5:   <%= stylesheet_link_tag    "application", :media => "all" %>
2012-08-08T21:03:41+00:00 app[web.1]:     6:   <%= javascript_include_tag "application" %>
2012-08-08T21:03:41+00:00 app[web.1]:     7:   <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"  %>
2012-08-08T21:03:41+00:00 app[web.1]:     8:   <%= javascript_include_tag :highcharts %>
2012-08-08T21:03:41+00:00 app[web.1]:     10: </head>
2012-08-08T21:03:41+00:00 app[web.1]:     11: <body>
2012-08-08T21:03:41+00:00 app[web.1]:     9:   <%= csrf_meta_tags %>
2012-08-08T21:03:41+00:00 app[web.1]:   app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___4426161850966429466_47229900'
2012-08-08T21:03:41+00:00 heroku[router]: GET floating-forest-7331.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4010ms status=304 bytes=0
....

编辑,如果你想看我的应用程序(我很感谢你检查它)这里是我的github

1 个答案:

答案 0 :(得分:0)

请尝试:

RAILS_ENV=production bundle exec rake assets:precompile

然后将创建的文件夹./public/assets/添加到您的Git存储库并推送到Heroku。


如果rake尝试连接到您的数据库,请添加./config/application.rb

config.assets.initialize_on_precompile = false

Precompiling Assets @ guides.rubyonrails.org