gpt4 book ai didi

node.js - "npm set registry https://registry.npmjs.org/"有什么作用?

转载 作者:行者123 更新时间:2023-12-03 12:10:56 27 4
gpt4 key购买 nike

我在使用 npm 安装 Cordova 时遇到问题。

从这里找到的答案,诀窍是运行 npm set registry https://registry.npmjs.org/这个命令究竟做了什么,为什么它解决了安装cordova的问题?

Stuck when installing cordova

最佳答案

如您所见 here ,npm Registry 是 Node.js、前端 Web 应用程序和整个 JavaScript 社区的开源代码包的公共(public)集合。

在 npm 的标准安装中,注册表设置为 https://registry.npmjs.org/ .也就是说,这是你运行时npm会下载包的地址npm install <anything> .

但是,您可以使用命令 npm set registry <new url> 更改此值。 .这意味着任何 future npm install命令将从 <new url> 获取包反而。如果您的公司运行自己的注册表私有(private)镜像,或者如果您想在 https://registry.npmjs.org/ 的情况下使用不同的镜像,您可能想要这样做。已关闭,或太慢。 This SO answer列出了几个替代镜像。

the trick is to run npm set registry https://registry.npmjs.org/ What exactly does this command do and why does it solve the problem of installing cordova?



此命令将注册表值重置为其默认值并导致 npm 从 https://registry.npmjs.org/ 下载包。 .为什么这解决了您的特定问题很难说,因为 https://registry.npmjs.org/是新安装 npm 的默认值。似乎有些东西改变了您计算机上的这个值,但如果没有更多信息,很难说是什么。

将来,您还可以使用 npm get registry 检查此值设置为什么。 .

关于node.js - "npm set registry https://registry.npmjs.org/"有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48987791/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com