新的应用创建好了,使用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"

重新启动服务一切正常。

相关文章:

  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-12
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案