在命令npm i npm之后更新节点时出错

时间:2018-09-01 10:23:22

标签: node.js npm npm-install

返回命令后出现以下错误

npm i npm

我的节点版本为 6.2.0

C:\Users\Shihas>npm i npm
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules
\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external com
mand,
operable program or batch file.
npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.npmjs.org/npm failed, reason: Hostname/IP d
oes not match certificate's altnames: Host: registry.npmjs.org. is not in the ce
rt's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Shihas\AppData\Roaming\npm-cache\_logs\2018-09-01T10_10_11
_873Z-debug.log

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

问题似乎是您在代理后面或网络出现问题,因此无法验证https证书。

您可以尝试添加此npm config set strict-ssl false以禁用ssl检查,然后尝试重新安装