Installing Bit components during CI


#1

To install Bit components in your application during CI you need to configure the @bit node registry in your CI server.

Note

Read more about installing components here

  1. Make sure you have a valid token generated for the CI server. To generate a token, run the following command:
$ npm login --registry=https://node.bitsrc.io --scope=@bit

The token will be available for you in your ~/.npmrc file.

It is also possible to use the token generated when authenticating a machine to Bit, using bit login. To see the token, run bit config.

  1. Set a secret to your CI environment variable called BIT_NODE_TOKEN. This step differs from one CI to another. Console your CI provider’s documentation to understand how to do it.

  2. Add a to your CI that configure the token to its default .npmrc file. For example:

$ echo @bit:registry=https://node.bitsrc.io\n//node.bitsrc.io/:_authToken={$BIT_NODE_TOKEN}" >> ~/.npmrc

CI authentication and authorization issues

  1. If you are using Yarn and getting HTTP 401, you need to configure always-auth=true at the top of your .npmrc file.

  2. If you are getting HTTP 404 (package not found) when trying to install components, there are two possible issues:

  • The CI server does not recognize @bit as a scoped registry. Ensure that @bit:registry=https://node.bitsrc.io is properly defined in the .npmrc file.
  • The package is not found on the @bit registry. If that’s the case, ensure that the token you use is still valid and that the user that the token is generated for as at least read access to the remove Scope.

#2