pm2 calls node, not nodejs

I installed pm2 following instructions. When I attempt to execute:

pm2 start app.js

It seems like it is looking for “node”, but when I installed node js, the command to run node is “nodejs” (something with name clash in ubuntu).

How can I setup pm2 to run “nodejs” instead of “node”?


Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@contrerasjorgev - The default method of installing NodeJS from the CLI is by using apt-get. If you are in need of the latest release, something repositories often do not provide, you’ll need to compile from source (which is honestly a better option).

You can download a simple bash script that functions as an auto-installer to simplify the installation. I would look at

Simply download the file, run a chmod +x on it from the CLI and execute and it should handle the basics for you without any issues.

You’ll still want to run apt-get install npm or install it from source as well (depending on what you prefer to do). Make note, however, that the above bash/shell script will install NodeJS to /usr/local/, so you would still need to create a symlink, or modify the bash script to extract to /usr/bin instead.

Regarding Ubuntu nodejs installation and the renaming of “node” to “nodes” … I am still confused.

I found the following instructions to install nodejs on Ubuntu:

Please note comment on the page:

“Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.”

Yet, your pm2 instructions seems to want “node” to be the command to run nodejs applications.

What I am doing wrong?

Please advise.

I would alias node to nodejs which is the conventional name for the nodejs binary. If you are sure that you are not going to install the nodejs Ubuntu package any time in the future, you can just create a symlink /usr/bin/node that points to /usr/bin/nodejs. This way, pm2 and any other packages that use the nodejs binary can refer to it as just node:

sudo ln -s "$(which nodejs)" /usr/bin/node