網頁

2011年8月28日 星期日

[ROR]Could not find a JavaScript runtime.

執行 rails server 發生下列錯誤: 


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

解決方式: 

參考

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

安裝 node.js

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

如果還是不行:

安裝 gem 


gem install execjs --no-ri --no-rdoc

gem install therubyracer --no-ri --no-rdoc
 
並且修改專案目錄內的 Gemfile
 
加入
 
gem 'execjs'
 
gem 'therubyracer'
 
之後在執行
 
 rails s



沒有留言:

張貼留言

LinkWithin

Related Posts with Thumbnails