1. Error message:
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. The reason for the error:
Execute the command to install,
npm install pm2 -g
-g, it is installed globally, so the permissions are not enough, you need to add sudo
Solution:
sudo npm install pm2 -g