npm ERR! code CERT_HAS_EXPIRED

执行npm i报错:

npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/react-redux failed, reason: connect ETIMEDOUT 104.16.2.35:443
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! code CERT_HAS_EXPIRED_第1张图片

原因:这个报错是因为npm服务器的SSL证书证书过期了。

解决方法:

1.win + R打开cmd,依次执行下方的命令即可。

清除npm缓存
npm cache clean --force

设置npm的严格SSL证书验证为false
npm config set strict-ssl false

安装
npm install

你可能感兴趣的:(npm,前端,node.js)