在安装了 Ruby 2.3.3、Rails 5.0.0.1 和 NodeJS 4.2.6 的 Ubuntu 16.04 上,我使用 bin/rails generate controller welcome index
生成了一个玩具 Controller 。运行 bin/rails server
后,我在浏览器中打开 http://localhost:3000/welcome/index
得到以下错误:
ExecJS::ProgramError in Welcome#index
Showing /rails-app-path/app/views/layouts/application.html.erb where line #7 raised:
ReferenceError: CoffeeScript is not defined
Extracted source (around line #7):
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
最佳答案
已回答 Here
最近更新的 coffe-script-source gem 1.12.1 有问题。问题是这个版本的源文件是空的。已经有一个 open issue ,它应该会尽快修复。
现在您可以将其添加到您的 GemFile
gem 'coffee-script-source', '= 1.11.1'
并运行 bundle update coffee-script-source
直到它被修复。
关于ruby-on-rails - 欢迎#index 中的 ExecJS::ProgramError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41172628/