在aliyun linux上npm install失败

发布时间 2023-12-02 16:12:56作者: johnny_zhao

今天在ESC上使用npm进行安装,出现以下错误:

npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/pm2 failed, reason: 
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 config set registry https://registry.npmmirror.com

检查是否设置成功:

npm config get registry

再进行安装:

npm install pm2 -g