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

 

 

你可能感兴趣的:(ubuntu,nodejs,ror,therubyracer)