当我的 asset/javascript 文件夹中有 CoffeeScript 文件时,我收到此错误
当我的 assets/javascript
文件夹中有 CoffeeScript 文件时,我收到以下错误
ExecJS::RuntimeError in Users/sessions#new
如果我删除咖啡脚本文件,一切都会正常运行。问题是什么?我该如何解决?
I get the following error when I have coffeescript files in my assets/javascript
folder
ExecJS::RuntimeError in Users/sessions#new
If I remove the coffee script files, everything works perfectly.. What is the issue? How can I solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ExecJS 是一个允许运行 JavaScript 的 Ruby 库。编译 CoffeeScript 需要它,因为 CoffeeScript 编译器本身就是一个 JavaScript 库。
但 ExecJS 本身不包含 JavaScript 运行时;相反,它会在您的系统上寻找一个。很难从您描述的错误中准确判断发生了什么,但似乎 ExecJS 尝试使用的任何 JavaScript 运行时都失败了。
您可能想尝试将 therubyracer 添加到项目的 gems 中;它是一个 JS 运行时,原则上应该适用于所有平台。
ExecJS is a Ruby lib that allows JavaScript to be run. It's needed to compile CoffeeScript because the CoffeeScript compiler is, itself, a JavaScript lib.
But ExecJS doesn't contain a JavaScript runtime itself; instead, it looks for one on your system. It's hard to tell from the error you're describing exactly what's going on, but it seems that whichever JavaScript runtime ExecJS is trying to use is failing.
You might want to try adding therubyracer to your project's gems; it's a JS runtime that, in principle, should work on all platforms.