ubuntu 12.04 rails server 时候报错 execjs

新的应用创建好了,使用rails server启动看看,oops!原来是没有javascript运行环境。

1
2
$ rails server 
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

需要引用两个gem分别是“execjs”和“therubyracer”,在应用跟目录下的GemFile中添加两行。这样启动的时候就会引用这两个gem了。

1
2
gem "execjs" 
gem "therubyracer"

重新启动服务一切正常。

posted @ 2014-07-31 21:17  juandx  阅读(218)  评论(0编辑  收藏  举报