Make Rails ExecJS recognize nodejs

Posted on

So your ExecJS can’t recognize node setup.
This is fairly simple, but sometimes tricky to detect problem.
Running a rails service which utilize ExecJS with node but ExecJS can’t recognize your node setup.

How ExecJS works

execjs will simply try to run node command for it’s uses. it’s that simple.

But I can run node commands and it’s there

Well, in that case, the most common mistake, when running a web server (nginx, apache, etc’..) is that the server usually runs as another user, let’s say root. and this other user might not have access to the node command, probably because it’s not in it’s $PATH variable.


There are two simple solutions:
– Add the node binary directory to the root’s $PATH
– Symlink the node binary to some directory which is in the root’s $PATHsudo ln -s /etc/path /usr/local/bin/node for example.

Leave a Reply

Your email address will not be published. Required fields are marked *