开发者

ExecJS problem compiling Rails 3.1 assets

My Rails 3.1.rc4 app was working fine, but I'm trying to figure out the appropriate way to store my js files in the pipeline. If I put any code in a file other than application.js, I get the following error:

Started GET "/assets/application.js" for 127.0.0.1 at 2011-07-21 23:15:02 -0500 Compiled ~/Dropbox/Rails/myapp/app/assets/javascripts/application.js.coffee (224ms) (pid 69397) Error compiling asset application.js: ExecJS::ProgramError: SyntaxError: Reserved word "function" on line 1 (in /Users/micahalcorn/Dropbox/Rails/myapp/app/assets/javascripts/users/registrations.js.coffee) Served asset /application.js - 500 Internal Server Error

This happens regardless of which file (registrations in this case) and claims a 'reserved word' regardless of the first word in the file (var, function, etc). I am using node.js as my runtime environment, and everything wo开发者_Python百科rks fine if I remove coffeescript compiling gems and treat it like a Rails 3.0 app. I want to better understand the asset pipeline and follow conventions. Thanks for any suggestions!


The error

SyntaxError: Reserved word "function" on line 1

is a CoffeeScript compiler error. Either convert function to -> in registrations.js.coffee, or rename it to registrations.js so that the file will be read as raw JavaScript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜