我在使用 cap deploy 进行部署时遇到问题:命令 bundle exec rake assets:precompile 失败(也在本地)
我正在使用 Rails 3.2.11
bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** 调用资产:预编译:全部(first_time)
** 执行资产:预编译:全部
** 调用 assets:precompile:primary (first_time)
** 调用资产:环境(first_time)
** 执行资产:环境
** 调用环境(first_time)
** 执行环境
** 调用 tmp:cache:clear (first_time)
** 执行 tmp:cache:clear
** 执行 assets:precompile:primary
耙中止!
意外标记:运算符 (<)(行:39879,列:0,位置:1151635)
错误
at new JS_Parse_Error (/tmp/execjs20130902-31115-1frab1p.js:2357:10736)
at js_error (/tmp/execjs20130902-31115-1frab1p.js:2357:10955)
at croak (/tmp/execjs20130902-31115-1frab1p.js:2357:18667)
at token_error (/tmp/execjs20130902-31115-1frab1p.js:2357:18804)
at unexpected (/tmp/execjs20130902-31115-1frab1p.js:2357:18892)
at expr_atom (/tmp/execjs20130902-31115-1frab1p.js:2357:26838)
at maybe_unary (/tmp/execjs20130902-31115-1frab1p.js:2357:29262)
at expr_ops (/tmp/execjs20130902-31115-1frab1p.js:2357:30020)
at maybe_conditional (/tmp/execjs20130902-31115-1frab1p.js:2357:30112)
at maybe_assign (/tmp/execjs20130902-31115-1frab1p.js:2357:30555)
at expression (/tmp/execjs20130902-31115-1frab1p.js:2357:30868)
at simple_statement (/tmp/execjs20130902-31115-1frab1p.js:2357:21834)
at /tmp/execjs20130902-31115-1frab1p.js:2357:20007
at /tmp/execjs20130902-31115-1frab1p.js:2357:19538
(在/home/ohunewald/rails_projects/bigAl/app/assets/javascripts/application.js)/home/ohunewald/.rvm/gems/ruby-1.9.3-p194@TestRails/gems/execjs-2.0.1/lib /execjs/external_runtime.rb:68:in `extract_result'
当我更改为: config.assets.compress = false 我可以部署它,但我的 Javascript 不再工作了。我搜索了所有内容,但没有找到可以搜索的地方:Unexpected token: operator (<) (line:39879 ...
我也看了这个答案:
bundle exec rake assets:预编译失败,出现“意外令牌”
但我没有帮助...
这是我的资产管道:
//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require_tree .
对于 css 文件:
*= require_self
*= require jquery.ui.all
*= require dataTables/src/demo_table_jui
*= require_tree .
任何帮助,将不胜感激。
更新:
经过大量尝试和错误后,我删除了 jquery.cookie.js 并且错误消失了。现在剩下的是一个css错误:
Invalid CSS after "...dding-left:8px}": expected selector or at-rule, was "<!DOCTYPE html>"
我会进一步调查...
奥利弗