My Rails3.1 app worked fine on Windows but got the "Could not find JavaScript runtime" error when running on Linux.
Solution:
?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
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

在遇到MyRails3.1应用在Linux环境下出现Could not find JavaScript runtime错误时,通过安装gem 'therubyracer'并确保其仅与CRuby(MRI)或Rubinius兼容解决了问题。此外,此问题也可能通过安装Node.js来解决。
250

被折叠的 条评论
为什么被折叠?



