错误提示:
rails server
/var/lib/gems/2.1.0/gems/execjs-2.3.0/lib/execjs/runtimes.rb:45:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
解决办法:
在ubuntu环境下解决方法如下(安装nodejs)
- sudo apt-get install python-software-properties
- sudo add-apt-repository ppa:chris-lea/node.js
- sudo apt-get update
- sudo apt-get install nodejs
或者:
在gemfile中添加
gem ‘execjs’
gem ‘therubyracer’
bundle install后即可