The client you use to interact with your npm On-Site server is the same client that you use with the public npm registry.
npm On-Site requires a 2.x or newer version of the npm client. You can get this by running:
[sudo] npm install npm -g
Once you have an up-to-date client, you can configure it to install from and publish to your private npm On-Site registry.
You can do this in one of two ways:
Read about each option below.
If you want all packages, whether they are under a scope or not, to be stored in your private registry, then you should configure the npm client to use your private npm On-Site appliance as the top level registry.
To do this, first set your On-Site registry as the CLI's default registry:
npm config set registry http://myreg.mycompany.com:8080
And then authenticate against your registry without a scope:
npm login --registry=http://myreg.mycompany.com:8080
When clients are configured this way, they will always use your private npm
On-Site registry as their main registry. When using npm install
, it will only
look in the private registry to find the package.
To make sure your On-Site instance supports this functionality, you should
enable the "Read Through Cache" setting (enabled by default) in the server's
admin console (https://myreg.mycompany.com:8800/settings
) so that public
packages are automatically mirrored from the public registry and automatically
added to your registry's whitelist.
If you want to default to using the public npm registry for most packages and only use your private registry for packages under a particular scope, then you can specify that the registry should only be used for that scope.
To do so, use npm login
with a registry and scope:
npm login --registry=http://myreg.mycompany.com:8080 --scope=@myco
The npm login
command will prompt you for your credentials. The credentials
you use should match the authentication strategy configured in the Settings of
your instance's admin console (https://myreg.mycompany.com:8800/settings
).
By default, these will be your GitHub or GitHub Enterprise credentials.
For details on GitHub Enterprise integration, please see this page.
For details on configuring custom authentication, please see this page.
Last modified January 27, 2016 Found a typo? Send a pull request!