Last Updated: February 25, 2016
·
3.329K
· snird

Make Rails ExecJS recognize nodejs

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.

Solutions?

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 $PATH - sudo ln -s /etc/path /usr/local/bin/node for example.

1 Response
Add your response

Hi David!

I am encountering a problem in usage of nodejs gem. I installed nodejs from http://nodejs.org/ for windows. I am totally an amateur for ruby, while I still wonder how do I use this nodejs file to solve my "EXECJS: Runtime unavailable " problem which occurred during my first program to build a database (RAKE & to create a scaffolding). I tried different probabilities (wage ones) not working bro! Can you embrace me with your experience on this?! Please.

hd_sachin@yahoo.co.in

Regards
SHD

over 1 year ago ·