I installed Node.js from binary. I downloaded the binary file from Node.js website and unzipped it in /opt/nodejs. Next, I set the binary path in /etc/environment in vim editor.
sudo vim /etc/environment
Adding “:/opt/nodejs/node-<version>-<os-type>/bin” in the end of PATH.
This is the beginning of my /etc/environment.
This is the end of /etc/environment.
There are a couple different ways to reload /etc/environment. Here is the most simplest way to reload /etc/environment.
. /etc/environment
Now, I can run Node.js command: node or npm.
Running Node.js