我已经安装了 Ruby 1.8.7 和 Rails 3.1.0 。
当我执行rails时,会触发此错误。
alberto@alberto:~/screencast/tasks$ rails s
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs.rb:2:in `require': /home/alberto/.rvm/gems/ree-1.8.7- 2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error, unexpected ':', expecting ')' (SyntaxError)
name: "Node.js (V8)",
^
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error, unexpected ',', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:23: syntax error, unexpected ',', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:24: syntax error, unexpected ',', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:26: syntax error, unexpected ')', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:29: syntax error, unexpected ':', expecting ')'
name: "JavaScriptCore",
^
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:29: syntax error, unexpected ',', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:30: syntax error, unexpected ',', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:32: syntax error, unexpected ')', expecting kEND
/home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:35: syntax error, unexpected ':', expecting ')'
name: "SpiderMonkey",
^
答案 0 :(得分:1)
看起来源使用新的键值语法(key: value
)而不是旧的表单(:key => "value"
)。您应该至少更新到Ruby 1.9。我想你可以修复源代码以使用旧的语法,但我真的建议在可能的情况下更新Ruby。