一、问题
环境
系统:centos 7
node :v18.16.1
npm:9.5.1
安装pm2
npm install -g pm2
提示报错:
npm WARN deprecated [email protected]: 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.
changed 184 packages in 17s
12 packages are looking for funding
run `npm fund` for details
二、解决
更新uuid
npm install uuid@latest -g
更新成功后,继续安装pm2,也会提示:npm WARN deprecated [email protected]: Please upgrade to version 7 or higher.
其实是已经安装成功了
1、查找pm2的安装位置
find / -name pm2
/usr/local/lib/node_modules/pm2
/usr/local/lib/node_modules/pm2/lib/templates/logrotate.d/pm2
/usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/lib/node_modules/pm2/pm2
2、增加pm2软链接
ln -s /usr/local/lib/node_modules/pm2/bin/pm2 /usr/local/bin
查看pm2版本
pm2 -v
即可