我正在部署到Heroku,但是我发现CSS文件没有被加载(在Heroku上也找不到)。
我看到需要先在本地运行rake assets:precompile,但是当我运行它时,出现以下错误:
C:\project>bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
undefined: Unexpected token: operator (<)
(in C:/project/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
我在application.js文件中没有任何内容,所以不理解错误出在哪里...
application.js是一个文件名。
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
谢谢
更新
如果删除一个 .js.erb 文件,我会得到以下错误:
C:\project>bundle exec rake assets:precompile RAILS_ENV=production --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
706: unexpected token at 'C:\Users\me\AppData\Local\Temp\execjs20111021-6448-ei2nm3.js(2, 3) Microsoft JScript runtime error: Out of memory
'
(in C:/project/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
仍然存在 erb css 和 js 文件无法编译的问题...
这似乎没有结束的迹象... 谢谢
javascripts
目录下有任何 JavaScript 文件吗?语句//= require_tree
尝试读取整个目录中的文件... - mliebelt