当我的 asset/javascript 文件夹中有 CoffeeScript 文件时,我收到此错误

发布于 2024-12-24 03:46:31 字数 186 浏览 5 评论 0原文

当我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坦然微笑 2024-12-31 03:46:31

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文