【发布时间】:2013-01-27 13:35:10
【问题描述】:
我在新安装的 Ubuntu 12.10 上关注 ruby on rails getting started guide。我准备运行rake db:create,但出现以下错误:
rake 中止! 找不到 JavaScript 运行时。有关可用运行时列表,请参阅 https://github.com/sstephenson/execjs。
我四处搜索,建议的解决方案(见下面的列表)是安装一些 therubyracer 或 nodejs,但他们没有解释原因。
- rake db:create - Could not find a JavaScript runtime
- Rails 3.1 error - Could not find a JavaScript runtime?
- http://datacodescotch.blogspot.com.au/2011/11/rails-31-spree-and-rake-aborted-could.html
- http://www.blog.railshouse.com/
在我开始安装之前,我想知道这些 JavaScript 运行时之间有什么区别,以及为什么我会选择其中一个?
更新:
我刚刚阅读了https://github.com/sstephenson/execjs(我知道我应该先阅读此内容,抱歉),在我看来 execjs 不是 JavaScript 运行时并且我已经拥有它......所以它取决于 therubyracer 和 nodejs .. . 请原谅我的无知,我已经修改了我的问题
除了 Intrepidd 的回答:
ruby on rails getting started guide 支持 Intrepidd 的回答。请参阅4.1 "Starting up the Web Server" 部分,其中写道:
Rails 在新的注释行中将 therubyracer gem 添加到 Gemfile 应用程序,如果需要,您可以取消注释。
对于那里的 Rails 新手(像我一样),GemFile 位于 Rails 应用程序的根文件夹中。在我的 GemFile 中取消注释该行后,我必须运行 bundle install 来安装 therubyracer gem。
【问题讨论】:
标签: javascript ruby-on-rails ruby ruby-on-rails-3 rake