Ruby on Rails中的错误
问题描述:
我正在尝试使用Rails“敏捷Web开发”一书学习Ruby on Rails。 在这本书中,它说如何为项目创建一个doc文件:Ruby on Rails中的错误
rails_apps> rails new dummy_app
rails_apps> cd dummy_app
dummy_app> rake doc:rails
,但我得到这个错误:
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
(See full trace by running task with --trace)
为什么呢?我该如何解决它?
答
您需要安装Javascript运行时。在错误消息(https://github.com/sstephenson/execjs)中的URL中列出了几个选项。如果您没有强烈的偏好,我建议您使用therubyracer(Google V8)。
只需添加到您的Gemfile
:
gem 'therubyracer', require: "v8"
和运行的
bundle install
+0
Iget this:语法错误,意外':',期待$ end gem'therubyracer',require:' v8' –
+0
如果你使用ruby “v8”'代替 –
可能重复[Rails的3.1 execjs,找不到一个JavaScript运行时(http://stackoverflow.com/问题/ 6282307/rails-3-1-execjs-and-could-not-find-a-javascript-runtime) –