Node forever /usr/bin/env: node: No such file or directory

Marc Rasmussen picture Marc Rasmussen · May 16, 2015 · Viewed 85.8k times · Source

I have installed nodejs using:

apt-get install nodejs

Then i have installed npm using:

apt-get install npm

And then i have installed forever using:

npm install forever -g

Now i go to my project /var/www/myproject

and attempt to run forever start server.js

then i get the following message:

/usr/bin/env: node: No such file or directory

Can anyone tell me whats going on?

Answer

chedabob picture chedabob · May 16, 2015

EDIT: As of December 2018, this is no longer the correct way. See the other two answers.

You need to symlink the nodejs executable to node sudo ln -s "$(which nodejs)" /usr/local/bin/node The reason for this is that when you do "apt-get install node", it installs an unrelated package, so they had to choose a different name so it wouldn't conflict