不再能够将 npm 从 6 升级到 7:"Using stale data" 从 UNABLE_TO_GET_ISSUER_CERT_LOCALLY
No longer able to upgrade npm from 6 to 7: "Using stale data" from UNABLE_TO_GET_ISSUER_CERT_LOCALLY
我正在使用 nvm 和最新的稳定节点 (16)
$ nvm ls
-> v16.2.0
npm 最近强制实施了 TLS 1.1 vague blog post。
根据 another blog post npm@latest
应该是 npm 7。但是,对我来说:
npm install -g npm@latest
npm WARN npm npm does not support Node.js v16.2.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_GET_ISSUER_CERT_LOCALLY: request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
+ npm@6.13.0
updated 1 package in 9.573s
你可以看到 @latest
对我来说解析为 npm 6.13.0,此警告的关键部分似乎是:
https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_GET_ISSUER_CERT_LOCALLY: request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
我曾经将我的注册表设置为使用 http,如:
$ npm config get registry
http://registry.npmjs.org/
所以我尝试取消设置,显然它会自动设置为 https
(这很好):
$ npm config delete registry
$ npm config get registry
https://registry.npmjs.org/
然而,当 运行 npm install -g npm@latest
时,我得到相同的“陈旧数据”和 UNABLE_TO_GET_ISSUER_CERT_LOCALLY
警告。 npm install -g npm
的警告相同。我无法再升级 npm。
我没有使用 VPN 或使用任何代理。我该如何解决?
首先我尝试使用 nvm 重新安装节点,这将我升级到 nvm 8,但未能解决问题:
nvm reinstall-packages 16
经过一番撞头之后,我发现我的 ~/.npmrc
中有一行:
ca[]=
出于某种原因,我将 npm 配置为没有用于验证 SSL 的根证书。删除该行解决了我的问题。
我正在使用 nvm 和最新的稳定节点 (16)
$ nvm ls
-> v16.2.0
npm 最近强制实施了 TLS 1.1 vague blog post。
根据 another blog post npm@latest
应该是 npm 7。但是,对我来说:
npm install -g npm@latest
npm WARN npm npm does not support Node.js v16.2.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_GET_ISSUER_CERT_LOCALLY: request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
+ npm@6.13.0
updated 1 package in 9.573s
你可以看到 @latest
对我来说解析为 npm 6.13.0,此警告的关键部分似乎是:
https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_GET_ISSUER_CERT_LOCALLY: request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
我曾经将我的注册表设置为使用 http,如:
$ npm config get registry
http://registry.npmjs.org/
所以我尝试取消设置,显然它会自动设置为 https
(这很好):
$ npm config delete registry
$ npm config get registry
https://registry.npmjs.org/
然而,当 运行 npm install -g npm@latest
时,我得到相同的“陈旧数据”和 UNABLE_TO_GET_ISSUER_CERT_LOCALLY
警告。 npm install -g npm
的警告相同。我无法再升级 npm。
我没有使用 VPN 或使用任何代理。我该如何解决?
首先我尝试使用 nvm 重新安装节点,这将我升级到 nvm 8,但未能解决问题:
nvm reinstall-packages 16
经过一番撞头之后,我发现我的 ~/.npmrc
中有一行:
ca[]=
出于某种原因,我将 npm 配置为没有用于验证 SSL 的根证书。删除该行解决了我的问题。