This time I will bring you a solution to the problem that the global module cannot be found innode.jsunder linux, and a solution to the problem that the node.js global module under linux cannot be found.What are the precautions?What are the following? This is a practical case, let’s take a look at it.
Today I used npmto installon linux and prepared to deploy the node project. However, when I started the project through the pm2 command, it reported that pm2 could not be found. This is very sad. , thinking that pm2 was not installed successfully, but there was no problem calling pm2 in the bin folder under the node installation directory.
/usr/local/node/node-v7.3.0-linux-x64/bin/pm2 list
Similarly call the pm2 list command to view the projects started by pm2 without any problem.
It turns out that after the module is installed globally through npm on the Linux system, the environment Configuring environment variables on Linux is very simple. You only need to modify the /etc/profile file. Just write the directory of the node module at the end of the profile file.export NODE_HOME=/usr/local/node/node-v7.3.0-linux-x64/bin export PATH=$NODE_HOME:$PATH
exit the system and reconnect again, and then the modified configuration will take effect. .
Execute the command directly
pm2 list
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
php Detailed explanation of steps to crop images to a fixed size php generates random numbers, letters or numeric letters Mixed stringThe above is the detailed content of Solve the problem that node.js global module cannot be found under Linux. For more information, please follow other related articles on the PHP Chinese website!