🎉
Welcome to Bit's new open-source website!

Install Components

Components once exported to a remote scope can be consumed in any other project/app with the package manager of your choice.

npm install @my-org/scope.my-component
yarn add @my-org/scope.my-component
CopiedCopy

You may also use Bit to install components:

bit install @my-org/scope.my-component
CopiedCopy

Once installing the component, the component resides in the node_modules directory.

To use the component in the code, import the code as follow:

import { myComponent } from '@my-org/scope.my-component';
CopiedCopy

Authenticate Package Manager with Bit.dev

When using bit.cloud for hosting components, consumers will need to configure their package manager to know where to fetch components from. Do this by configuring .npmrc file:

  1. First of all - install Bit on your system.
  2. Run the following command:
bit login
CopiedCopy
  1. Bit generated a .npmrc in your user-home directory (~ in macOS/Linux, %USERPROFILE% in Windows) with a basic config containing your authentication token.
  2. Open the .npmrc file and add the following line (complete the account name according to where components are hosted)
@ACCOUNT:registry=https://node.bit.cloud
CopiedCopy

An example configured .npmrc file looks something like this:

@teambit:registry=https://node.bit.cloud
//node.bit.cloud/:_authToken=<TOKEN>
CopiedCopy

For Self-hosted Components

When self hosting Bit on your own server you need to publish the components as packages to any package registry. The authentication process for the package manager is very much the same other then the fact you can't use bit login to set your token.

next

Renaming components

Rename a new or versioned component.

Continue