简体   繁体   English

如何在 bit.dev 中安装私有 npm 包?

[英]How to install private npm package in bit.dev?

I'm try to install a private NPM package but is failing when using bit install.我尝试安装私有 NPM 包,但在使用 bit install 时失败了。

I also tried using yarn install to add the package just to check if I have the right access and it works.我还尝试使用 yarn install 添加包,只是为了检查我是否有正确的访问权限并且它有效。 纱线安装

Here's the screenshot of the error encountering when installing.这是安装时遇到的错误的屏幕截图。 位安装

It is looking at https://node.bit.cloud/ instead of https://registry.npmjs.org/ .它正在查看https://node.bit.cloud/而不是https://registry.npmjs.org/

Thanks in advance for the help.先谢谢您的帮助。

I was also coming across the same issue from the consuming side.我也从消费方遇到了同样的问题。 And it's definitely the setting of the bit auth token.这绝对是位授权令牌的设置。 Sometimes it's invalid when setting it within.npmrc.在.npmrc 中设置有时无效。 (run npm config list) Sometimes works, sometimes doesn't. (运行 npm config list)有时有效,有时无效。 But, what solved it for me was setting via cmd line like so:但是,为我解决的是通过 cmd 行设置,如下所示:

npm config set BIT_REGISTRY=https://node.bit.cloud
npm config set @teambit:registry=https://node.bit.cloud
npm config set //node.bit.cloud/: authToken ${BIT_TOKEN}
npm i

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

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