执行命令资产时出错:预编译

时间:2017-11-23 00:39:43

标签: ruby-on-rails ruby handlebars.js rake assets

尝试 RAILS_ENV =生产包exec rake资产:预编译

收到此错误消息:

ExecJS::ProgramError: Unexpected token: operator (>) (line: 48027, col: 50, pos: 1986183)

Error
    at new JS_Parse_Error (<eval>:2357:10748)
    at js_error (<eval>:2357:10967)
    at croak (<eval>:2357:19192)
    at token_error (<eval>:2357:19329)
    at unexpected (<eval>:2357:19417)
    at expr_atom (<eval>:2357:27609)
    at maybe_unary (<eval>:2357:30102)
    at expr_ops (<eval>:2357:30860)
    at maybe_conditional (<eval>:2357:30952)
    at maybe_assign (<eval>:2357:31395)
    at maybe_assign (<eval>:2357:31569)
    at expression (<eval>:2357:31708)
    at expr_list (<eval>:2357:27913)
    at subscripts (<eval>:2357:29811)
  (in /home/parts-soft/www/parts-soft/releases/20171122232617/apps/www/app/assets/javascripts/application.js)
new JS_Parse_Error ((execjs):2357:10748)
js_error ((execjs):2357:10967)
croak ((execjs):2357:19192)
token_error ((execjs):2357:19329)
unexpected ((execjs):2357:19417)
expr_atom ((execjs):2357:27609)
maybe_unary ((execjs):2357:30102)
expr_ops ((execjs):2357:30860)
maybe_conditional ((execjs):2357:30952)
maybe_assign ((execjs):2357:31395)
maybe_assign ((execjs):2357:31569)
expression ((execjs):2357:31708)
expr_list ((execjs):2357:27913)
subscripts ((execjs):2357:29811)
/home/parts-soft/.rvm/gems/ruby-2.0.0-p247@parts-script-new-admin/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:36:in `rescue in block in eval'
/home/parts-soft/.rvm/gems/ruby-2.0.0-p247@parts-script-new-admin/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:33:in `block in eval'
/home/parts-soft/.rvm/gems/ruby-2.0.0-p247@parts-script-new-admin/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:75:in `block in lock'

当我执行 RAILS_ENV =生产捆绑执行rake资产时:预编译:全部

Sprockets::FileNotFound: couldn't find file 'handlebars.runtime'
  (in /home/oil/www/oil/releases/20171122232617/apps/www/app/assets/javascripts/application.js:32)

告诉我该怎么办?
在app.js我没有改变任何东西

1 个答案:

答案 0 :(得分:0)

在本地编译所有资产。

请尝试以下步骤:

  1. Gemfile

    中添加以下代码

    group :assets do gem 'sass-rails' gem 'coffee-rails' gem 'therubyracer' end

  2. 运行bundle install

  3. 更改config / environments / production.rb中的行   config.assets.compile = true

  4. 运行命令:

    RAILS_ENV=production rake assets:precompile