一、介绍
- pm2是一个进程管理工具,可以用它来管理node进程,并查看node进程的状态,当然也支持性能监控,进程守护,负载均衡等功能,在前端和nodejs的世界中用的很多。
二、安装pm2
全局安装pm2,执行命令:
sudo npm install pm2 -g
-g全局安装
这里要加sudo,不然会报错,没有权限。
三、报错处理
3.1 npm ERR! code ECONNRESET
1、报错信息:
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/dayjs failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhaohui/.npm/_logs/2023-04-13T08_55_41_290Z-debug-0.log
2、报错原因:
执行命令安装,
npm install pm2 -g
-g,是全局安装,这样权限不够,需要加sudo
解决办法:
sudo npm install pm2 -g
3.2 npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher.
报错信息:
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
added 185 packages in 1m
12 packages are looking for funding
run npm fund
for details
原因就是uuid的版本太低了。
解决办法:
升级uuid,指定要升级到的uuid版本
sudo npm install [email protected] -g
版权归原作者 做测试的喵酱 所有, 如有侵权,请联系我们删除。