Node.js npm Scopes and repositories


# Set the repository for the scope "myscope"
npm config set @myscope:registry

# Login at a repository and associate it with the scope "myscope"
npm adduser --registry= --scope=@myscope

# Install a package "mylib" from the scope "myscope"
npm install @myscope/mylib

If the name of your own package starts with @myscope and the scope "myscope" is associated with a different repository, npm publish will upload your package to that repository instead.

You can also persist these settings in a .npmrc file:


This is useful when automating the build on a CI server f.e.