In Development

execjs doesn't find nodejs

Whilst deploying a Rails 3.2 app to a new Ubuntu 14.04 box running REE 1.8.7 I ran into this error:

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Most people suggest installing nodejs, like this:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Which I had already done.

The answer was to update config/boot.rb to include the following lines:

ENV["PATH"] = "/usr/bin:#{ENV['PATH']}"
ENV["EXECJS_RUNTIME"] = 'Node'
May 27, 2014