Installing Components using Package Managers

Bit components can be installed with any package manager that implements the CommonJS package registry specification. Popular examples would be Yarn and NPM.

Once Bit components are organized in remote Scopes, they can be installed with any package manager client that implements the CommonJS package registry specification such as Yarn or NPM.

For example, you can check out our movie-app demo Scope and install any component from that Scope components using NPM or Yarn.

yarn add @bit/bit.movie-app.components.hero

Configuring Bit as a registry in NPM and Yarn clients

Bit can be configured as a registry with any CommonJS compatible client such as NPM and Yarn.

Configuring Bit as a scoped registry

Bit can be configured as a scoped registry and can be associated with any scope name.

npm config set '@bit:registry' https://node.bitsrc.io

To install private components from bitsrc.io, use npm login to associate Bit with an authenticated scope. Use your Bit credentials to login.

npm login --registry=https://node.bitsrc.io --scope=@bit

To learn more about NPM scoped registries, please refer to NPM’s documentation.

Configuring Bit as a proxy registry

For better user experience, Bit can be configured as a proxy registry in Yarn and NPM. Bit will proxy any request to the NPM official registry.

npm config set registry https://node.bitsrc.io

Package naming convention

Package naming convention includes the Bit owner, Scope name, namespace and the component name.

An example for installing a component using Yarn or NPM would be as following:

yarn add <owner>.<scope>.<namespace>.<component-name>