2019-11-05 14:55:08 -05:00
|
|
|
|
---
|
|
|
|
|
title: registry
|
2020-11-01 07:54:36 +01:00
|
|
|
|
section: 7
|
2019-11-05 14:55:08 -05:00
|
|
|
|
description: The JavaScript Package Registry
|
|
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
|
|
|
|
To resolve packages by name and version, npm talks to a registry website
|
|
|
|
|
that implements the CommonJS Package Registry specification for reading
|
|
|
|
|
package info.
|
|
|
|
|
|
2021-01-28 17:38:39 -05:00
|
|
|
|
npm is configured to use the **npm public registry** at
|
2018-08-29 12:03:09 -07:00
|
|
|
|
<https://registry.npmjs.org> by default. Use of the npm public registry is
|
2021-07-27 16:39:44 +00:00
|
|
|
|
subject to terms of use available at <https://docs.npmjs.com/policies/terms>.
|
2018-08-29 12:03:09 -07:00
|
|
|
|
|
|
|
|
|
You can configure npm to use any compatible registry you like, and even run
|
|
|
|
|
your own registry. Use of someone else's registry may be governed by their
|
|
|
|
|
terms of use.
|
|
|
|
|
|
|
|
|
|
npm's package registry implementation supports several
|
2011-11-21 09:48:45 -08:00
|
|
|
|
write APIs as well, to allow for publishing packages and managing user
|
|
|
|
|
account information.
|
|
|
|
|
|
2018-08-29 12:03:09 -07:00
|
|
|
|
The npm public registry is powered by a CouchDB database,
|
2021-01-28 17:38:39 -05:00
|
|
|
|
of which there is a public mirror at <https://skimdb.npmjs.com/registry>.
|
2014-09-24 14:41:07 -07:00
|
|
|
|
|
|
|
|
|
The registry URL used is determined by the scope of the package (see
|
2022-12-06 22:18:33 -05:00
|
|
|
|
[`scope`](/using-npm/scope). If no scope is specified, the default registry is
|
|
|
|
|
used, which is supplied by the [`registry` config](/using-npm/config#registry)
|
|
|
|
|
parameter. See [`npm config`](/commands/npm-config),
|
|
|
|
|
[`npmrc`](/configuring-npm/npmrc), and [`config`](/using-npm/config) for more on
|
|
|
|
|
managing npm's configuration.
|
|
|
|
|
Authentication configuration such as auth tokens and certificates are configured
|
|
|
|
|
specifically scoped to an individual registry. See
|
|
|
|
|
[Auth Related Configuration](/configuring-npm/npmrc#auth-related-configuration)
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2023-01-16 22:38:23 -05:00
|
|
|
|
When the default registry is used in a package-lock or shrinkwrap it has the
|
2021-10-07 20:21:11 +00:00
|
|
|
|
special meaning of "the currently configured registry". If you create a lock
|
|
|
|
|
file while using the default registry you can switch to another registry and
|
|
|
|
|
npm will install packages from the new registry, but if you create a lock
|
|
|
|
|
file while using a custom registry packages will be installed from that
|
|
|
|
|
registry even after you change to another registry.
|
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
|
### Does npm send any information about me back to the registry?
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
|
|
Yes.
|
|
|
|
|
|
|
|
|
|
When making requests of the registry npm adds two headers with information
|
|
|
|
|
about your environment:
|
|
|
|
|
|
|
|
|
|
* `Npm-Scope` – If your project is scoped, this header will contain its
|
|
|
|
|
scope. In the future npm hopes to build registry features that use this
|
|
|
|
|
information to allow you to customize your experience for your
|
|
|
|
|
organization.
|
|
|
|
|
* `Npm-In-CI` – Set to "true" if npm believes this install is running in a
|
2018-11-29 14:05:52 -08:00
|
|
|
|
continuous integration environment, "false" otherwise. This is detected by
|
2016-12-18 20:22:09 -08:00
|
|
|
|
looking for the following environment variables: `CI`, `TDDIUM`,
|
|
|
|
|
`JENKINS_URL`, `bamboo.buildKey`. If you'd like to learn more you may find
|
|
|
|
|
the [original PR](https://github.com/npm/npm-registry-client/pull/129)
|
|
|
|
|
interesting.
|
|
|
|
|
This is used to gather better metrics on how npm is used by humans, versus
|
|
|
|
|
build farms.
|
|
|
|
|
|
2018-07-18 13:55:52 -07:00
|
|
|
|
The npm registry does not try to correlate the information in these headers
|
|
|
|
|
with any authenticated accounts that may be used in the same requests.
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
2021-01-28 17:38:39 -05:00
|
|
|
|
### How can I prevent my package from being published in the official registry?
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2021-01-28 17:38:39 -05:00
|
|
|
|
Set `"private": true` in your `package.json` to prevent it from being
|
2011-11-21 09:48:45 -08:00
|
|
|
|
published at all, or
|
|
|
|
|
`"publishConfig":{"registry":"http://my-internal-registry.local"}`
|
2021-01-28 17:38:39 -05:00
|
|
|
|
to force it to be published only to your internal/private registry.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2019-11-18 21:01:39 +02:00
|
|
|
|
See [`package.json`](/configuring-npm/package-json) for more info on what goes in the package.json file.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2022-12-06 22:18:33 -05:00
|
|
|
|
### Where can I find my (and others') published packages?
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2021-01-28 17:38:39 -05:00
|
|
|
|
<https://www.npmjs.com/>
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
|
### See also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
2020-11-01 07:54:36 +01:00
|
|
|
|
* [npm config](/commands/npm-config)
|
2019-11-05 14:55:08 -05:00
|
|
|
|
* [config](/using-npm/config)
|
|
|
|
|
* [npmrc](/configuring-npm/npmrc)
|
|
|
|
|
* [npm developers](/using-npm/developers)
|