In this getting started guide you will get setup with your Hosted Private npm registry from Nodejitsu as well as learn about some of the best practices for working with
But first, take a look at this 4 minute introduction to our Private npm solution.
Just like the public registry, the
npm CLI program is what you'll use to install, publish and otherwise interact with npm modules. Nodejitsu Enterprise private npm has two changes in the configuration to your npm CLI client:
Why do you need to do these things?
- Every request requires authentication: This means that users you have not authorized cannot download packages from your private npm. Since this is not the default behavior of the public npm you need to set:
- Be strict about SSL: We improved our SSL experience, now our Private npm registry supports multi-level wildcard certificate issued by DigiCert and serves
https://*.registry.nodejitsu.com, so you'll need to set the following to your npm config:
Requests can be made against your private npm in two ways:
- Set the registry for all requests: This means that every request will hit your private registry
- Use the
--regflag when necessary: The
--regflag (short for
--registry) will allow you to make any request against your private registry:
We recommend that you set the registry for all requests to avoid any accidental publishes of private modules to the public registry. Since all new publishes go by default to your private npm registry when you need to publish a new public npm package** you can explicitly set the
More information available at the Command Line Interface Documentation
More information available at the Web Interface Documentation
publishConfig in your package.json does the following (from the npm documentation):
This is a set of config values that will be used at publish-time. It's especially handy if you want to set the tag or registry, so that you can ensure that a given package is not tagged with "latest" or published to the global public registry by default.
Any config values can be overridden, but of course only "tag" and "registry" probably matter for the purposes of publishing.
The benefits of using
publishConfig is that it avoids accidental publishes to the public registry due to user error. Take for example a developer on your team who has not properly configured their machine by running
npm config set registry or using the
--reg flag. That command would send your code public. By using the
publishConfig property you avoid that because it is part of your application.