简体   繁体   English

我如何 NPM 从私有注册表全局安装 package

[英]How do I NPM install package globally from private registry

I have private npm registry 'A' , and using.npmrc in my repo我有私人 npm 注册表'A' ,并在我的仓库中使用.npmrc
.npmrc is .npmrc 是

registry=A

then when I install axios like npm i axios , axios gotten from my A registry.然后当我像npm i axios一样安装 axios 时, Z38C3787939C7B0B6C9Z7D3 来自我A ADF 注册表。
but when I install axios globally npm i axios -g , axios gotten from npm registry ( https://registry.npmjs.org/npm ) but when I install axios npm i axios -g , axios gotten from npm registry ( https://registry.npmjs.org/npm )

how do i install package globally from my private registry?如何从我的私人注册表全局安装 package?

thanks!谢谢!

You need to set up the registry for npm globally.您需要为 npm 全局设置注册表。 Open a terminal and type打开终端并输入

npm config set registry="<your-registry-address>"

After adding it you can check it with添加后,您可以检查它

npm config list

Or you can open directly the global .npmrc config at C:\Users\you_user\ , if you already added something with npm config set .或者你可以直接在C:\Users\you_user\打开全局.npmrc配置,如果你已经用npm config set添加了一些东西。 (The file is created when the first entry is added and removed when the last entry is deleted with npm config delete <entry_for_delete> ). (当使用npm config delete <entry_for_delete>最后一个条目时添加和删除第一个条目时创建文件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM