kenniz 发表于 2013-1-28 16:07:24

Could not find a JavaScript runtime

My Rails3.1 app worked fine on Windows but got the "Could not find JavaScript runtime" error when running on Linux.
Solution:
 
gem 'therubyracer', :platforms => :ruby The trick is knowing that :platforms => :ruby actually means only use this gem with "C Ruby(MRI) or Rubinius, but NOT Windows."
 
Windows has a builtin JavaScript engine which execjs can locate. On Linux there is not a builtin although there are plenty available to be installed. therubyracer is one of them.
 
Also, this problem could be resloved by installing nodejs
 
sudo apt-get install nodejs
 
 
页: [1]
查看完整版本: Could not find a JavaScript runtime