ipa*_*tch 6 javascript ruby-on-rails asset-pipeline ruby-on-rails-4
我正在尝试使用以下命令为Rails 4.1.1应用程序编译资产,RAILS_ENV=production bundle exec rake assets:precompile
但是当rails尝试编译资产时,它会给我一个错误.
错误如下所示,
$ RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
ExecJS::ProgramError: Unexpected character '#' (line: 13079, col: 0, pos: 361024)
Error
at new JS_Parse_Error (<eval>:2357:10623)
at js_error (<eval>:2357:10842)
at parse_error (<eval>:2357:12560)
at Object.next_token [as input] (<eval>:2357:17582)
at next (<eval>:2357:18881)
at semicolon (<eval>:2357:19726)
at simple_statement (<eval>:2357:22538)
at <eval>:2357:20689
at <eval>:2357:19938
at <eval>:2357:31926
at Object.parse (<eval>:2358:98)
(in /opt/rails/crj.com/app/assets/javascripts/application.js)/home/capin/.gem/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/capin/.gem/ruby/2.1.0/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:61:in `block (3 levels) in define'
/home/capin/.gem/ruby/2.1.0/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:60:in `block (2 levels) in define'
V8::Error: Unexpected character '#'
at js_error (<eval>:2357:10842)
at parse_error (<eval>:2357:12560)
at next_token (<eval>:2357:17582)
at next (<eval>:2357:18881)
at semicolon (<eval>:2357:19726)
at simple_statement (<eval>:2357:22538)
at <eval>:2357:20689
at <eval>:2357:19938
at <eval>:2357:31926
at parse (<eval>:2358:98)
at <eval>:19:24
at <eval>:53:3
/home/capin/.gem/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/capin/.gem/ruby/2.1.0/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:61:in `block (3 levels) in define'
/home/capin/.gem/ruby/2.1.0/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:60:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)
我尝试使用--trace
switch/option 运行上面提到的命令,但是对于导致此错误的原因我有点无能为力.这个项目可以在这里查看=> https://github.com/ipatch/crj.com
这很可能是因为rails会为您生成一个空的coffescript文件,作为您在项目中生成控制器的一部分.您也可能将coffescript重命名为.js
在空的js文件中,您将找到自动生成的coffescript注释,该注释以#而不是//由javascript使用.只需删除所有评论,您就可以开始了.
由于在您的示例的第13079行中找到了意外的'#'字符,因此您将在同一行找到您的评论.
归档时间: |
|
查看次数: |
3604 次 |
最近记录: |