“Npm”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
 
(未显示同一用户的1个中间版本)
第8行: 第8行:
 
<syntaxhighlight lang="powershell">
 
<syntaxhighlight lang="powershell">
 
C:\WINDOWS\system32>npm config set registry https://registry.npm.taobao.org
 
C:\WINDOWS\system32>npm config set registry https://registry.npm.taobao.org
 +
</syntaxhighlight>'''坑''':2024-08-09,执行如下:<syntaxhighlight lang="powershell">
 +
C:\WINDOWS\system32>npm install -g @vue/cli
 +
npm ERR! code CERT_HAS_EXPIRED
 +
npm ERR! errno CERT_HAS_EXPIRED
 +
npm ERR! request to https://registry.npm.taobao.org/@vue%2fcli failed, reason: certificate has expired
 +
 +
npm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2024-08-08T23_00_40_398Z-debug-0.log
 +
</syntaxhighlight>原因是 <nowiki>https://registry.npm.taobao.org</nowiki> 这个域名不用了,用浏览器访问就能发现,已经重定向到 https://registry.npmmirror.com/<nowiki/>,所以换了就好:<syntaxhighlight lang="powershell">
 +
C:\WINDOWS\system32>npm config set registry https://registry.npmmirror.com
 +
 +
C:\WINDOWS\system32>npm config get registry
 +
https://registry.npmmirror.com
 +
 +
C:\WINDOWS\system32>npm install -g @vue/cli
 +
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
 +
……
 +
added 852 packages in 36s
 +
 +
74 packages are looking for funding
 +
  run `npm fund` for details
 
</syntaxhighlight>
 
</syntaxhighlight>

2024年8月8日 (四) 23:11的最新版本

Npm 查看 registry

C:\WINDOWS\system32>npm config get registry
https://registry.npmjs.org/

npm 配置镜像

C:\WINDOWS\system32>npm config set registry https://registry.npm.taobao.org

:2024-08-09,执行如下:

C:\WINDOWS\system32>npm install -g @vue/cli
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/@vue%2fcli failed, reason: certificate has expired

npm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2024-08-08T23_00_40_398Z-debug-0.log

原因是 https://registry.npm.taobao.org 这个域名不用了,用浏览器访问就能发现,已经重定向到 https://registry.npmmirror.com/,所以换了就好:

C:\WINDOWS\system32>npm config set registry https://registry.npmmirror.com

C:\WINDOWS\system32>npm config get registry
https://registry.npmmirror.com

C:\WINDOWS\system32>npm install -g @vue/cli
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
……
added 852 packages in 36s

74 packages are looking for funding
  run `npm fund` for details