There are several issues you may encounter when you install or import a component from bit.dev.
NPM or Yarn throws ‘package not found’ when importing a component
If you are importing a component using
bit import, and you get a message similar to these:
failed running npm install at /Users/iteymendel/devenv/example-npm-error/components/utils/string/pad-left npm ERR! code E404 npm ERR! 404 Not Found: @email@example.com
failed running yarn install at /Users/iteymendel/devenv/example-npm-error/components/utils/string/pad-left error An unexpected error occurred: "https://registry.yarnpkg.com/@bit%2fbit.utils.string.pad-left: Not found".
This means that when a component you are importing from bit.dev has other component dependencies, by default Bit will try to install the dependencies as node modules, using NPM or Yarn. This means that your package manager needs to have
@bit defined as a scoped registry, so it can install packages from there.
To do so, run the following command and use your bit.dev credentials.
npm login --registry=https://node.bit.dev --scope=@bit
Or without authentication to Bit (for public component only):
npm config set '@bit:registry' https://node.bit.dev
Read more about this feature here.
Getting unauthorized (401) when installing a component
Not sufficient permissions to the remote Collection
You do not have the right permissions on the Collection that the components are hosted in, and unable to access its components.
To resolve this issue contact the Collection admin, and request for Read permissions.
Yarn does not send the authentication token with the install command
If you have the required permission to install components from a Collection, and you are pulling a repository which has a committed yarn.lock file, and the installation of components returns an error saying it is ‘unauthorized’ (HTTP 401), this means that you encounter an open issue that causes Yarn not to send its authentication token when installing packages from a
To resolve this set the always-auth parameter to true in the project’s
.npmrc. This will force the authentication token to each package installation.