NPM and node commands are installed in /usr/local/bin using soft links after nodejs is decompressed from binary packages.

After the http-server is installed, it cannot run. The command cannot be found.

Finally, modify the environment variable configuration file to solve the problem:

Modify the /etc/profile file

sudo vi /etc/profile
Copy the code

Add the following at the end

export PATH="$PATH: / usr/local/nodejs (change)/bin"
Copy the code

You need to run the following command for the Settings to take effect

source /etc/profile
Copy the code