Installing a Package from Registry

The very first time you create a registry, it will be created as private by default. To install a package from a private registry you need to authenticate. You can authenticate as we showed in the previous step. If your registry is not private but public you can skip the authentication, but still you must tell npm to install the certain scoped packages from a certain registry. For this you need to set a configuration.

npm config set @foo:registry<username>/<registryName>

You don’t have to set this configuration if you do authenticate. npm login will set it for you.

Now in a project’s base directory -which includes a package.json file- you can install any package from the registry. Just don’t forget to provide the scope name of that package.

npm install @foo/foo

That’s it. If you have not missed any step, npm will install your package from your registry.