0

我在 app/assets/javascripts/ 中创建了一些 js 文件并运行了 rake assets:precompile,但是 rails 生成了这个错误。

rake aborted!
Unexpected token: operator (>) (line: 14562, col: 9, pos: 545705)

Error<br />
at new JS_Parse_Error (<eval>:1720:22)<br />
at js_error (<eval>:1728:15)<br />
at croak (<eval>:2189:17)<br />
at token_error (<eval>:2196:17)<br />
at unexpected (<eval>:2202:17)<br />
at <eval>:2580:17<br />
at maybe_unary (<eval>:2665:27)<br />
at expr_op (<eval>:2685:45)<br />

在 expr_ops (:2692:24)
在maybe_conditional (:2696:28)
在maybe_assign (:2720:28)
在:2734:28
在prog1 (:2768:23)
(在/home/anybuy/anybuy/app/assets/ javascripts/application.js)
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execj-> > 1.4.0/lib/execjs/ruby_racer_runtime.rb:34:inrescue in block in eval' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:28:in块在评估中'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in block in lock'<br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:78:incall'
/home/ anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in Locker' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:78:inlock'
/home/anybuy/.rvm/gems /ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:27:in eval' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/execjs-> 1.4.0/lib/execjs/ruby_racer_runtime.rb:19:inexec'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/uglifier-1.3.0/lib/uglifier.rb:100:in > compile' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/compressors.rb:74:incompress'
/home/anybuy/.rvm/ gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/processing.rb:265:in block in js_compressor=' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/processor.rb:29:incall'
/home/anybuy/.rvm/gems/ruby-1.9。 3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/processor.rb:29:inevaluate' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in >渲染'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2。 8/gems/sprockets-> 2.1.3/lib/sprockets/context.rb:177:in block in evaluate' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/context.rb:174:ineach'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets- > 2.1.3/lib/sprockets/context.rb:174:inevaluate' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/bundled_asset.rb:26:in初始化'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib /sprockets/base.rb:244:在new'<br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:244:inbuild_asset'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/index.rb:89:in block in build_asset' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/caching.rb:19:incache_asset'
/home/anybuy/。 rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/index.rb:88:in build_asset' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:163:infind_asset'
/home/anybuy/.rvm/gems/ruby- 1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/index.rb:56:in find_asset' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/static_compiler.rb:23:inblock in compile'
/home/anybuy/.rvm/gems/ruby-1.9.3- p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:212:in block in each_logical_path' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:200:inblock (2 levels) in each_file'
/home/anybuy/.rvm/gems/ruby-1.9.3- p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:190:in each' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:190:ineach_entry'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/宝石/链轮-> 2.1.3/lib/sprockets/base.rb:198:在block in each_file' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:197:in每个'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:197:in each_file' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/sprockets-> 2.1.3/lib/sprockets/base.rb:210:ineach_logical_path'
/home/anybuy /.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/static_compiler.rb:18:in compile' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:56:ininternal_precompile'
/home/anybuy/.rvm/gems/ ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:70:in block (3 levels) in <top (required)>' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:60:inblock (3 levels) in '
Tasks: TOP => assets:precompile:primary
(通过使用 --trace 运行任务查看完整跟踪)
rake aborted!
命令失败,状态为 (1):[/home/anybuy/.rvm/rubies/ruby-1.9.3-p392/b...]
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@ 3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:ruby_rake_task' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:21:ininvoke_or_reboot_rake_task'
/home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/gems/actionpack-> 3.2.8/lib/sprockets/assets.rake:29:in block (2 levels) in <top (required)>' <br /> /home/anybuy/.rvm/gems/ruby-1.9.3-p392@3.2.8/bin/ruby_noexec_wrapper:14:ineval'
/home/anybuy /.rvm/gems/ruby-1.9.3-p392@3.2.8/bin/ruby_noexec_wrapper:14:in `'
Tasks: TOP => assets:precompile
(通过使用 --trace 运行任务查看完整跟踪)

这是我的 app/assets/javascripts/application.js

// 这是一个清单文件,它将被编译成 application.js,其中将包含下面列出的所有文件。
// // 此目录中的任何 JavaScript/Coffee 文件、lib/assets/javascripts、>vendor/assets/javascripts、// 或插件的 vendor/assets/javascripts,如果有的话,都可以在此处使用相对 >path 进行引用。
// // 不建议直接在此处添加代码,但如果这样做,它将出现在
// 编译文件的底部 >。
// //警告:第一个空白行标志着要处理的内容的结束,任何空白行都应该
// 遵循以下要求。
// //= 需要 jquery
//= 需要 jquery_ujs
//= 需要 jquery.ui.all
//= 需要 twitter/bootstrap
//= 需要 twitter/bootstrap/bootstrap-transition
//= 需要 twitter/bootstrap/bootstrap-alert
//= 需要 twitter/bootstrap/bootstrap-modal
//= 需要 twitter/bootstrap/bootstrap-按钮
//= 需要 twitter/bootstrap/bootstrap-collapse
//= require_tree 。

4

0 回答 0