英文:
How to install a private bit.dev package in a react project?
问题
我已尝试在一个React项目中安装了一个公共Bit Cloud包,它可以正常工作。
yarn config set '@bit:registry' https://node.bit.dev
yarn add @bit/<scope-name>.<module-name>.<component-name>
但是我如何安装一个私有Bit Cloud包?
英文:
I have tried installing a public bit cloud package in a react project and it works.
yarn config set '@bit:registry' https://node.bit.dev
yarn add @bit/<scope-name>.<module-name>.<component-name>
But how can I intsall a private bit cloud package?
答案1
得分: 1
I got the answer
Step 1
执行 bit login
。这会在你的根目录中创建一个 .npmrc
文件。
- Windows:
"C:\Users\<username>\.npmrc"
- Mac 和 Linux:
~/.npmrc
Step 2
将文件中以 //node.bit
开头的行复制并添加到你项目目录中的本地 .npmrc
文件中。在你的 .npmrc
文件末尾添加 always-auth=true
。例如:
@<organization-name>:registry=https://node.bit.cloud
//node.bitsrc.io/:_authToken=xxxxx-bit-token-xxxxx
//node.bit.cloud/:_authToken=xxxxx-bit-token-xxxxx
always-auth=true
Step 3
安装包
yarn add @<organization-name>/<scope-name>.<module-name>.<component-name>
英文:
I got the answer
Step 1
Do bit login
. This will create a .npmrc
in your root directory.
- Windows:
"C:\Users\<username>\.npmrc"
- Mac and Linux:
~/.npmrc
Step 2
Copy the lines starting with //node.bit
from the file and add that to your local .npmrc
file in your project directory. Add always-auth=true
to the end of your .npmrc
. Eg:
@<organization-name>:registry=https://node.bit.cloud
//node.bitsrc.io/:_authToken=xxxxx-bit-token-xxxxx
//node.bit.cloud/:_authToken=xxxxx-bit-token-xxxxx
always-auth=true
Step 3
Install the packages
yarn add @<organization-name>/<scope-name>.<module-name>.<component-name>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论