This time I will bring you how to deal with the problem that the global module cannot be found under linuxnode.jsHow to deal with the problem that the global module of node.js under linux cannot be foundWhat are the precautionsWhat are the following? This is a practical case, let’s take a look at it.
Today I used npm to install on 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
There is no problem calling the pm2 list command like this to view the projects started by pm2.
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 directlypm2 list
Recommended reading:
How to use AngularJS to implement tab switchingHow to use Koa2 to develop WeChat 2D Scan the QR code to payThe above is the detailed content of How to deal with the node.js global module cannot be found under Linux. For more information, please follow other related articles on the PHP Chinese website!