From 70b4517a4e7ef7ced91bdc0ed5e9fbaf698c256b Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Fri, 15 Jan 2021 16:09:24 -0500 Subject: [PATCH] deps: upgrade npm to 7.4.2 --- deps/npm/AUTHORS | 1 + deps/npm/CHANGELOG.md | 75 ++ deps/npm/docs/content/commands/npm-audit.md | 1 - deps/npm/docs/content/commands/npm-ci.md | 2 +- deps/npm/docs/content/commands/npm-prefix.md | 14 +- deps/npm/docs/content/commands/npm-search.md | 85 +- .../docs/content/commands/npm-shrinkwrap.md | 14 +- deps/npm/docs/content/commands/npm-start.md | 32 +- deps/npm/docs/content/commands/npm-stop.md | 26 +- deps/npm/docs/content/commands/npm-test.md | 23 +- deps/npm/docs/content/commands/npm-token.md | 29 +- .../docs/content/commands/npm-uninstall.md | 47 +- .../docs/content/commands/npm-unpublish.md | 29 +- .../docs/content/configuring-npm/install.md | 53 +- ...inkwrap-json.md => npm-shrinkwrap-json.md} | 20 +- .../npm/docs/content/configuring-npm/npmrc.md | 53 +- .../content/configuring-npm/package-json.md | 743 ++++++++++-------- .../configuring-npm/package-lock-json.md | 257 ++++-- .../content/configuring-npm/package-locks.md | 178 ----- deps/npm/docs/output/commands/npm-audit.html | 1 - deps/npm/docs/output/commands/npm-ci.html | 2 +- deps/npm/docs/output/commands/npm-ls.html | 2 +- deps/npm/docs/output/commands/npm-prefix.html | 11 +- deps/npm/docs/output/commands/npm-search.html | 76 +- .../docs/output/commands/npm-shrinkwrap.html | 14 +- deps/npm/docs/output/commands/npm-start.html | 27 +- deps/npm/docs/output/commands/npm-stop.html | 22 +- deps/npm/docs/output/commands/npm-test.html | 18 +- deps/npm/docs/output/commands/npm-token.html | 32 +- .../docs/output/commands/npm-uninstall.html | 53 +- .../docs/output/commands/npm-unpublish.html | 25 +- deps/npm/docs/output/commands/npm.html | 2 +- .../docs/output/configuring-npm/install.html | 51 +- ...rap-json.html => npm-shrinkwrap-json.html} | 21 +- .../docs/output/configuring-npm/npmrc.html | 53 +- .../output/configuring-npm/package-json.html | 718 +++++++++-------- .../configuring-npm/package-lock-json.html | 284 +++++-- .../output/configuring-npm/package-locks.html | 310 -------- deps/npm/lib/link.js | 3 + deps/npm/lib/ls.js | 2 +- deps/npm/lib/search.js | 2 +- deps/npm/lib/token.js | 2 +- deps/npm/lib/uninstall.js | 2 +- deps/npm/lib/unpublish.js | 2 +- deps/npm/man/man1/npm-audit.1 | 2 - deps/npm/man/man1/npm-ci.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 17 +- deps/npm/man/man1/npm-search.1 | 88 ++- deps/npm/man/man1/npm-shrinkwrap.1 | 15 +- deps/npm/man/man1/npm-start.1 | 35 +- deps/npm/man/man1/npm-stop.1 | 29 +- deps/npm/man/man1/npm-test.1 | 24 +- deps/npm/man/man1/npm-token.1 | 28 +- deps/npm/man/man1/npm-uninstall.1 | 56 +- deps/npm/man/man1/npm-unpublish.1 | 29 +- deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man5/install.5 | 51 +- ...hrinkwrap-json.5 => npm-shrinkwrap-json.5} | 22 +- deps/npm/man/man5/npmrc.5 | 53 +- deps/npm/man/man5/package-json.5 | 739 +++++++++-------- deps/npm/man/man5/package-lock-json.5 | 295 ++++--- deps/npm/man/man5/package-locks.5 | 200 ----- .../@npmcli/arborist/lib/arborist/index.js | 1 + .../arborist/lib/arborist/load-actual.js | 15 +- .../@npmcli/arborist/lib/arborist/reify.js | 2 +- .../node_modules/@npmcli/arborist/lib/diff.js | 5 + .../node_modules/@npmcli/arborist/lib/edge.js | 24 + .../@npmcli/arborist/lib/index.js | 1 + .../node_modules/@npmcli/arborist/lib/node.js | 74 ++ .../@npmcli/arborist/lib/shrinkwrap.js | 8 +- .../@npmcli/arborist/package.json | 9 +- .../metavuln-calculator/lib/advisory.js | 131 ++- .../@npmcli/metavuln-calculator/package.json | 2 +- .../node_modules/@npmcli/move-file/README.md | 9 +- .../node_modules/@npmcli/move-file/index.js | 83 +- .../move-file/node_modules/rimraf/LICENSE | 15 + .../move-file/node_modules/rimraf/README.md | 101 +++ .../move-file/node_modules/rimraf/bin.js | 50 ++ .../node_modules/rimraf/package.json | 29 + .../move-file/node_modules/rimraf/rimraf.js | 372 +++++++++ .../@npmcli/move-file/package.json | 5 +- .../node_modules/make-fetch-happen/index.js | 4 + .../make-fetch-happen/package.json | 2 +- deps/npm/node_modules/pacote/README.md | 5 + deps/npm/node_modules/pacote/lib/fetcher.js | 1 + deps/npm/node_modules/pacote/lib/registry.js | 25 +- deps/npm/node_modules/pacote/package.json | 4 +- deps/npm/package.json | 8 +- .../test-lib-link.js-TAP.test.js | 5 + deps/npm/test/lib/link.js | 58 ++ deps/npm/test/lib/ls.js | 1 + deps/npm/test/lib/outdated.js | 3 + 93 files changed, 3736 insertions(+), 2422 deletions(-) rename deps/npm/docs/content/configuring-npm/{shrinkwrap-json.md => npm-shrinkwrap-json.md} (61%) delete mode 100644 deps/npm/docs/content/configuring-npm/package-locks.md rename deps/npm/docs/output/configuring-npm/{shrinkwrap-json.html => npm-shrinkwrap-json.html} (88%) delete mode 100644 deps/npm/docs/output/configuring-npm/package-locks.html rename deps/npm/man/man5/{shrinkwrap-json.5 => npm-shrinkwrap-json.5} (56%) delete mode 100644 deps/npm/man/man5/package-locks.5 create mode 100644 deps/npm/node_modules/@npmcli/move-file/node_modules/rimraf/LICENSE create mode 100644 deps/npm/node_modules/@npmcli/move-file/node_modules/rimraf/README.md create mode 100755 deps/npm/node_modules/@npmcli/move-file/node_modules/rimraf/bin.js create mode 100644 deps/npm/node_modules/@npmcli/move-file/node_modules/rimraf/package.json create mode 100644 deps/npm/node_modules/@npmcli/move-file/node_modules/rimraf/rimraf.js diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index ff19da4cf80a63..0a9c02f8b7d2b7 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -746,3 +746,4 @@ fuhao.xu marsonya <16393876+marsonya@users.noreply.github.com> Jeff Griffiths Michael Garvin +Gar diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 6688fb0f5bd47b..8c7be543469327 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,78 @@ +## v7.4.2 (2021-01-15) + +### DEPENDENCIES + +* [`e5ce6bbba`](https://github.com/npm/cli/commit/e5ce6bbbad82b85c8e74a4558503513e4f337476) + * `@npmcli/arborist@2.0.5` + * fix creating missing dirs when using --prefix and --global + * fix omit types of deps in global installs + * fix prioritizing npm-shrinkwrap.json over package-lock.json + * better cache system for packuments + * improves audit performance + +## v7.4.1 (2021-01-14) + +### BUG FIXES + +* [`23df96d33`](https://github.com/npm/cli/commit/23df96d3394ba0b69a37f416d7f0c26bb9354975) + [#2486](https://github.com/npm/cli/issues/2486) + npm link no longer deletes entire project when global prefix is a symlink + ([@nlf](https://github.com/nlf)) + +### DOCUMENTATION + +* [`7dd0dfc59`](https://github.com/npm/cli/commit/7dd0dfc59c861e7d3e30a86a8e6db10872fc6b44) + [#2459](https://github.com/npm/cli/issues/2459) + fix(docs): clean up `npm start` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`307b3bd9f`](https://github.com/npm/cli/commit/307b3bd9f90e96fcc8805a1d5ddec80787a3d3a7) + [#2460](https://github.com/npm/cli/issues/2460) + fix(docs): clean up `npm stop` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`23f01b739`](https://github.com/npm/cli/commit/23f01b739d7a01a7dc3672322e14eb76ff33d712) + [#2462](https://github.com/npm/cli/issues/2462) + fix(docs): clean up `npm test` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`4b43656fc`](https://github.com/npm/cli/commit/4b43656fc608783a29ccf8495dc305459abc5cc7) + [#2463](https://github.com/npm/cli/issues/2463) + fix(docs): clean up `npm prefix` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`1135539ba`](https://github.com/npm/cli/commit/1135539bac9f98bb1a5d5ed05227a8ecd19493d3) + [`a07bb8e69`](https://github.com/npm/cli/commit/a07bb8e692a85b55d51850534c09fa58224c2285) + [`9b55b798e`](https://github.com/npm/cli/commit/9b55b798ed8f2b9be7b3199a1bfc23b1cd89c4cd) + [`cd5eeaaa0`](https://github.com/npm/cli/commit/cd5eeaaa08eabb505b65747a428c3c59159663dc) + [`6df69ce10`](https://github.com/npm/cli/commit/6df69ce107912f8429665eb851825d2acebc8575) + [`dc6b2a8b0`](https://github.com/npm/cli/commit/dc6b2a8b032d118be3566ce0fa7c67c171c8d2cb) + [`a3c127446`](https://github.com/npm/cli/commit/a3c1274460e16d1edbdca6a0cee86ef313fdd961) + [#2464](https://github.com/npm/cli/issues/2464) + fix(docs): clean up `npm uninstall` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`cfdcf32fd`](https://github.com/npm/cli/commit/cfdcf32fd7628501712b8cad4a541c6b8e7b66bc) + [#2474](https://github.com/npm/cli/issues/2474) + fix(docs): clean up `npm unpublish` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`acd5b062a`](https://github.com/npm/cli/commit/acd5b062a811fcd98849df908ce26855823ca671) + [#2475](https://github.com/npm/cli/issues/2475) + fix(docs): update `package-lock.json` docs + ([@isaacs](https://github.com/isaacs)) +* [`b0b0edf6d`](https://github.com/npm/cli/commit/b0b0edf6de1678de7f4a000700c88daa5f7194ef) + [#2482](https://github.com/npm/cli/issues/2482) + fix(docs): clean up `npm token` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`35559201a`](https://github.com/npm/cli/commit/35559201a4a0a5b111ce58d6824e5b4030eb4496) + [#2487](https://github.com/npm/cli/issues/2487) + fix(docs): clean up `npm search` docs + ([@wraithgar](https://github.com/wraithgar)) + +### DEPENDENCIES + +* [`ea8c02169`](https://github.com/npm/cli/commit/ea8c02169cfbf0484d67db7c0e7a6ec8aecb7210) + `@npmcli/arborist@2.0.5` +* [`fb6f2c313`](https://github.com/npm/cli/commit/fb6f2c313d1d9770cc7d02a3900c7945df3cb661) + `pacote@11.2.1` +* [`c549b7657`](https://github.com/npm/cli/commit/c549b76573b1835a63e1e5898e9c16860079d84e) + `make-fetch-happen@8.0.13` + ## v7.4.0 (2021-01-07) ### FEATURES diff --git a/deps/npm/docs/content/commands/npm-audit.md b/deps/npm/docs/content/commands/npm-audit.md index 2c0a8f58047ca2..7ad950a6ba99e8 100644 --- a/deps/npm/docs/content/commands/npm-audit.md +++ b/deps/npm/docs/content/commands/npm-audit.md @@ -190,5 +190,4 @@ $ npm audit --audit-level=moderate ### See Also * [npm install](/commands/npm-install) -* [package-locks](/configuring-npm/package-locks) * [config](/using-npm/config) diff --git a/deps/npm/docs/content/commands/npm-ci.md b/deps/npm/docs/content/commands/npm-ci.md index 0d874f4f27a50f..925ba8de2e5b7e 100644 --- a/deps/npm/docs/content/commands/npm-ci.md +++ b/deps/npm/docs/content/commands/npm-ci.md @@ -68,4 +68,4 @@ cache: ### See Also * [npm install](/commands/npm-install) -* [package-locks](/configuring-npm/package-locks) +* [package-lock.json](/configuring-npm/package-lock-json) diff --git a/deps/npm/docs/content/commands/npm-prefix.md b/deps/npm/docs/content/commands/npm-prefix.md index 6894cb5c9298cc..9c33bb18901ef4 100644 --- a/deps/npm/docs/content/commands/npm-prefix.md +++ b/deps/npm/docs/content/commands/npm-prefix.md @@ -12,13 +12,25 @@ npm prefix [-g] ### Description -Print the local prefix to standard out. This is the closest parent directory +Print the local prefix to standard output. This is the closest parent directory to contain a `package.json` file or `node_modules` directory, unless `-g` is also specified. If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/commands/npm-config) for more detail. +### Example + +```bash +npm prefix +/usr/local/projects/foo +``` + +```bash +npm prefix -g +/usr/local +``` + ### See Also * [npm root](/commands/npm-root) diff --git a/deps/npm/docs/content/commands/npm-search.md b/deps/npm/docs/content/commands/npm-search.md index 991bfe9e131f22..33864d472d4a20 100644 --- a/deps/npm/docs/content/commands/npm-search.md +++ b/deps/npm/docs/content/commands/npm-search.md @@ -16,35 +16,42 @@ aliases: s, se, find Search the registry for packages matching the search terms. `npm search` performs a linear, incremental, lexically-ordered search through package -metadata for all files in the registry. If color is enabled, it will further -highlight the matches in the results. +metadata for all files in the registry. If your terminal has color +support, it will further highlight the matches in the results. This can +be disabled with the config item `color` -Additionally, using the `--searchopts` and `--searchexclude` options paired with -more search terms will respectively include and exclude further patterns. The -main difference between `--searchopts` and the standard search terms is that the -former does not highlight results in the output and can be used for more -fine-grained filtering. Additionally, both of these can be added to `.npmrc` for -default search filtering behavior. +Additionally, using the `--searchopts` and `--searchexclude` options +paired with more search terms will include and exclude further patterns. +The main difference between `--searchopts` and the standard search terms +is that the former does not highlight results in the output and you can +use them more fine-grained filtering. Additionally, you can add both of +these to your config to change default search filtering behavior. Search also allows targeting of maintainers in search results, by prefixing their npm username with `=`. -If a term starts with `/`, then it's interpreted as a regular expression and -supports standard JavaScript RegExp syntax. A trailing `/` will be ignored in -this case. (Note that many regular expression characters must be escaped or -quoted in most shells.) - -### A Note on caching +If a term starts with `/`, then it's interpreted as a regular expression +and supports standard JavaScript RegExp syntax. In this case search will +ignore a trailing `/` . (Note you must escape or quote many regular +expression characters in most shells.) ### Configuration +All of the following can be defined in a `.npmrc` file, or passed as +parameters to the cli prefixed with `--` (e.g. `--json`) + #### description * Default: true * Type: Boolean -Used as `--no-description`, disables search matching in package descriptions and -suppresses display of that field in results. +#### color + + * Default: true + * Type: Boolean + +Used as `--no-color`, disables color highlighting of matches in the +results. #### json @@ -66,9 +73,9 @@ Output search results as lines with tab-separated columns. * Type: Boolean Display full package descriptions and other long text across multiple -lines. When disabled (default) search results are truncated to fit -neatly on a single line. Modules with extremely long names will -fall on multiple lines. +lines. When disabled (which is the default) the output will +truncate search results to fit neatly on a single line. Modules with +extremely long names will fall on multiple lines. #### searchopts @@ -84,23 +91,37 @@ Space-separated options that are always passed to search. Space-separated options that limit the results from search. -#### searchstaleness - -* Default: 900 (15 minutes) -* Type: Number - -The age of the cache, in seconds, before another registry request is made. - #### registry * Default: https://registry.npmjs.org/ * Type: url -Search the specified registry for modules. If you have configured npm to point -to a different default registry, such as your internal private module -repository, `npm search` will default to that registry when searching. Pass a -different registry url such as the default above in order to override this -setting. +Search the specified registry for modules. If you have configured npm to +point to a different default registry (such as your internal private +module repository), `npm search` will also default to that registry when +searching. + +### A note on caching + +The npm cli caches search results with the same terms and options +locally in its cache. You can use the following to change how and when +the cli uses this cache. See [`npm cache`](/commands/npm-cache) for more +on how the cache works. + +#### prefer-online + +Forced staleness checks for cached searches, making the cli look for +updates immediately even for fresh search results. + +#### prefer-offline + +Bypasses staleness checks for cached. Missing data will still be +requested from the server. To force full offline mode, use `offline`. + +#### offline + +Forces full offline mode. Any searches not locally cached will result in +an error. ### See Also @@ -108,3 +129,5 @@ setting. * [npm config](/commands/npm-config) * [npmrc](/configuring-npm/npmrc) * [npm view](/commands/npm-view) +* [npm cache](/commands/npm-cache) +* https://npm.im/npm-registry-fetch diff --git a/deps/npm/docs/content/commands/npm-shrinkwrap.md b/deps/npm/docs/content/commands/npm-shrinkwrap.md index 05d5706b9f9f1f..dce50b7843bc3e 100644 --- a/deps/npm/docs/content/commands/npm-shrinkwrap.md +++ b/deps/npm/docs/content/commands/npm-shrinkwrap.md @@ -13,18 +13,18 @@ npm shrinkwrap ### Description This command repurposes `package-lock.json` into a publishable -`npm-shrinkwrap.json` or simply creates a new one. The file created and updated -by this command will then take precedence over any other existing or future -`package-lock.json` files. For a detailed explanation of the design and purpose -of package locks in npm, see [package-locks](/configuring-npm/package-locks). +`npm-shrinkwrap.json` or simply creates a new one. The file created and +updated by this command will then take precedence over any other existing +or future `package-lock.json` files. For a detailed explanation of the +design and purpose of package locks in npm, see +[package-lock-json](/configuring-npm/package-lock-json). ### See Also * [npm install](/commands/npm-install) * [npm run-script](/commands/npm-run-script) * [npm scripts](/using-npm/scripts) -* [package.js](/configuring-npm/package-json) -* [package-locks](/configuring-npm/package-locks) +* [package.json](/configuring-npm/package-json) * [package-lock.json](/configuring-npm/package-lock-json) -* [shrinkwrap.json](/configuring-npm/shrinkwrap-json) +* [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) * [npm ls](/commands/npm-ls) diff --git a/deps/npm/docs/content/commands/npm-start.md b/deps/npm/docs/content/commands/npm-start.md index 8083bf8b7818e4..4791719b592f66 100644 --- a/deps/npm/docs/content/commands/npm-start.md +++ b/deps/npm/docs/content/commands/npm-start.md @@ -12,13 +12,39 @@ npm start [-- ] ### Description -This runs an arbitrary command specified in the package's `"start"` property of -its `"scripts"` object. If no `"start"` property is specified on the -`"scripts"` object, it will run `node server.js`. +This runs a predefined command specified in the `"start"` property of +a package's `"scripts"` object. + +If the `"scripts"` object does not define a `"start"` property, npm +will run `node server.js`. + +Note that this is different from the default node behavior of running +the file specified in a package's `"main"` attribute when evoking with +`node .` As of [`npm@2.0.0`](https://blog.npmjs.org/post/98131109725/npm-2-0-0), you can use custom arguments when executing scripts. Refer to [`npm run-script`](/commands/npm-run-script) for more details. +### Example + +```json +{ + "scripts": { + "start": "node foo.js" + } +} +``` + +```bash +npm start + +> npm@x.x.x start +> node foo.js + +(foo.js output would be here) + +``` + ### See Also * [npm run-script](/commands/npm-run-script) diff --git a/deps/npm/docs/content/commands/npm-stop.md b/deps/npm/docs/content/commands/npm-stop.md index 17156c97c40430..9e8f9be360fd9f 100644 --- a/deps/npm/docs/content/commands/npm-stop.md +++ b/deps/npm/docs/content/commands/npm-stop.md @@ -12,7 +12,31 @@ npm stop [-- ] ### Description -This runs a package's "stop" script, if one was provided. +This runs a predefined command specified in the "stop" property of a +package's "scripts" object. + +Unlike with [npm start](/commands/npm-start), there is no default script +that will run if the `"stop"` property is not defined. + +### Example + +```json +{ + "scripts": { + "stop": "node bar.js" + } +} +``` + +```bash +npm stop + +> npm@x.x.x stop +> node bar.js + +(bar.js output would be here) + +``` ### See Also diff --git a/deps/npm/docs/content/commands/npm-test.md b/deps/npm/docs/content/commands/npm-test.md index b8f25d520c8217..2cc6a2e38b0f1d 100644 --- a/deps/npm/docs/content/commands/npm-test.md +++ b/deps/npm/docs/content/commands/npm-test.md @@ -14,7 +14,28 @@ aliases: t, tst ### Description -This runs a package's "test" script, if one was provided. +This runs a predefined command specified in the `"test"` property of +a package's `"scripts"` object. + +### Example + +```json +{ + "scripts": { + "test": "node test.js" + } +} +``` + +```bash +npm test +> npm@x.x.x test +> node test.js + +(test.js output would be here) +``` + + ### See Also diff --git a/deps/npm/docs/content/commands/npm-token.md b/deps/npm/docs/content/commands/npm-token.md index 3716a0990299b1..652079453702e7 100644 --- a/deps/npm/docs/content/commands/npm-token.md +++ b/deps/npm/docs/content/commands/npm-token.md @@ -16,8 +16,8 @@ description: Manage your authentication tokens This lets you list, create and revoke authentication tokens. * `npm token list`: - Shows a table of all active authentication tokens. You can request this as - JSON with `--json` or tab-separated values with `--parseable`. + Shows a table of all active authentication tokens. You can request + this as JSON with `--json` or tab-separated values with `--parseable`. ```bash +--------+---------+------------+----------+----------------+ @@ -40,10 +40,17 @@ This lets you list, create and revoke authentication tokens. ``` * `npm token create [--read-only] [--cidr=]`: - Create a new authentication token. It can be `--read-only` or accept a list of - [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) ranges to - limit use of this token to. This will prompt you for your password, and, if you have - two-factor authentication enabled, an otp. + Create a new authentication token. It can be `--read-only`, or accept + a list of + [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + ranges with which to limit use of this token. This will prompt you for + your password, and, if you have two-factor authentication enabled, an + otp. + + Currently, the cli can not generate automation tokens. Please refer to + the [docs + website](https://docs.npmjs.com/creating-and-viewing-access-tokens) + for more information on generating automation tokens. ```bash +----------------+--------------------------------------+ @@ -58,7 +65,9 @@ This lets you list, create and revoke authentication tokens. ``` * `npm token revoke `: - This removes an authentication token, making it immediately unusable. This can accept - both complete tokens (as you get back from `npm token create` and will - find in your `.npmrc`) and ids as seen in the `npm token list` output. - This will NOT accept the truncated token found in `npm token list` output. + Immediately removes an authentication token from the registry. You + will no longer be able to use it. This can accept both complete + tokens (such as those you get back from `npm token create`, and those + found in your `.npmrc`), and ids as seen in the parseable or json + output of `npm token list`. This will NOT accept the truncated token + found in the normal `npm token list` output. diff --git a/deps/npm/docs/content/commands/npm-uninstall.md b/deps/npm/docs/content/commands/npm-uninstall.md index fe3c871138c19f..258431cbd9f944 100644 --- a/deps/npm/docs/content/commands/npm-uninstall.md +++ b/deps/npm/docs/content/commands/npm-uninstall.md @@ -7,7 +7,7 @@ description: Remove a package ### Synopsis ```bash -npm uninstall [<@scope>/][@]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save] +npm uninstall [<@scope>/][@]... [-S|--save|--no-save] aliases: remove, rm, r, un, unlink ``` @@ -17,40 +17,43 @@ aliases: remove, rm, r, un, unlink This uninstalls a package, completely removing everything npm installed on its behalf. -Example: +It also removes the package from the `dependencies`, `devDependencies`, +`optionalDependencies`, and `peerDependencies` objects in your +`package.json`. -```bash -npm uninstall sax -``` +Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm +will update those files as well. -In global mode (ie, with `-g` or `--global` appended to the command), -it uninstalls the current package context as a global package. - -`npm uninstall` takes 3 exclusive, optional flags which save or update -the package version in your main package.json: +`--no-save` will tell npm not to remove the package from your +`package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. -* `-S, --save`: Package will be removed from your `dependencies`. +`--save` or `-S` will tell npm to remove the package from your +`package.json`, `npm-shrinkwrap.json`, and `package-lock.json` files. +This is the default, but you may need to use this if you have for +instance `save=false` in your `npmrc` file -* `-D, --save-dev`: Package will be removed from your `devDependencies`. +In global mode (ie, with `-g` or `--global` appended to the command), +it uninstalls the current package context as a global package. +`--no-save` is ignored in this case. -* `-O, --save-optional`: Package will be removed from your `optionalDependencies`. +Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). -* `--no-save`: Package will not be removed from your `package.json` file. +### Examples -Further, if you have an `npm-shrinkwrap.json` then it will be updated as -well. +```bash +npm uninstall sax +``` -Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). +`sax` will no longer be in your `package.json`, `npm-shrinkwrap.json`, or +`package-lock.json` files. -Examples: ```bash -npm uninstall sax --save -npm uninstall @myorg/privatepackage --save -npm uninstall node-tap --save-dev -npm uninstall dtrace-provider --save-optional npm uninstall lodash --no-save ``` +`lodash` will not be removed from your `package.json`, +`npm-shrinkwrap.json`, or `package-lock.json` files. + ### See Also * [npm prune](/commands/npm-prune) diff --git a/deps/npm/docs/content/commands/npm-unpublish.md b/deps/npm/docs/content/commands/npm-unpublish.md index b39a7c09eb6e4e..e9d6e9045c6f9e 100644 --- a/deps/npm/docs/content/commands/npm-unpublish.md +++ b/deps/npm/docs/content/commands/npm-unpublish.md @@ -6,6 +6,10 @@ description: Remove a package from the registry ### Synopsis +To learn more about how the npm registry treats unpublish, see our unpublish policies + #### Unpublishing a single version of a package ```bash @@ -20,22 +24,26 @@ npm unpublish [<@scope>/] --force ### Warning -Consider using the `deprecate` command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package. +Consider using the [`deprecate`](/commands/npm-deprecate) command instead, +if your intent is to encourage users to upgrade, or if you no longer +want to maintain a package. ### Description -This removes a package version from the registry, deleting its -entry and removing the tarball. - -If no version is specified, or if all versions are removed then -the root package entry is removed from the registry entirely. +This removes a package version from the registry, deleting its entry and +removing the tarball. -Even if a package version is unpublished, that specific name and -version combination can never be reused. In order to publish the -package again, a new version number must be used. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed. +The npm registry will return an error if you are not [logged +in](/commands/npm-login). -To learn more about how unpublish is treated on the npm registry, see our unpublish policies. +If you do not specify a version or if you remove all of a package's +versions then the registry will remove the root package entry entirely. +Even if you unpublish a package version, that specific name and version +combination can never be reused. In order to publish the package again, +you must use a new version number. If you unpublish the entire package, +you may not publish any new versions of that package until 24 hours have +passed. ### See Also @@ -44,3 +52,4 @@ To learn more about how unpublish is treated on the npm registry, see our +* Don't put "js" or "node" in the name. It's assumed that it's js, since + you're writing a package.json file, and you can specify the engine using + the "engines" field. (See below.) +* The name will probably be passed as an argument to require(), so it + should be something short, but also reasonably descriptive. +* You may want to check the npm registry to see if there's something by + that name already, before you get too attached to it. + A name can be optionally prefixed by a scope, e.g. `@myorg/mypackage`. See [`scope`](/using-npm/scope) for more detail. @@ -48,14 +53,15 @@ A name can be optionally prefixed by a scope, e.g. `@myorg/mypackage`. See ### version If you plan to publish your package, the *most* important things in your -package.json are the name and version fields as they will be required. The name -and version together form an identifier that is assumed to be completely unique. -Changes to the package should come along with changes to the version. If you don't -plan to publish your package, the name and version fields are optional. +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional. Version must be parseable by -[node-semver](https://github.com/npm/node-semver), which is bundled -with npm as a dependency. (`npm install semver` to use it yourself.) +[node-semver](https://github.com/npm/node-semver), which is bundled with +npm as a dependency. (`npm install semver` to use it yourself.) More on version numbers and ranges at [semver](/using-npm/semver). @@ -66,8 +72,8 @@ package, as it's listed in `npm search`. ### keywords -Put keywords in it. It's an array of strings. This helps people -discover your package as it's listed in `npm search`. +Put keywords in it. It's an array of strings. This helps people discover +your package as it's listed in `npm search`. ### homepage @@ -82,71 +88,83 @@ Example: ### bugs The url to your project's issue tracker and / or the email address to which -issues should be reported. These are helpful for people who encounter issues -with your package. +issues should be reported. These are helpful for people who encounter +issues with your package. It should look like this: ```json -{ "url" : "https://github.com/owner/project/issues" -, "email" : "project@hostname.com" +{ + "url" : "https://github.com/owner/project/issues", + "email" : "project@hostname.com" } ``` -You can specify either one or both values. If you want to provide only a url, -you can specify the value for "bugs" as a simple string instead of an object. +You can specify either one or both values. If you want to provide only a +url, you can specify the value for "bugs" as a simple string instead of an +object. If a url is provided, it will be used by the `npm bugs` command. ### license -You should specify a license for your package so that people know how they are -permitted to use it, and any restrictions you're placing on it. +You should specify a license for your package so that people know how they +are permitted to use it, and any restrictions you're placing on it. -If you're using a common license such as BSD-2-Clause or MIT, add a -current SPDX license identifier for the license you're using, like this: +If you're using a common license such as BSD-2-Clause or MIT, add a current +SPDX license identifier for the license you're using, like this: ```json -{ "license" : "BSD-3-Clause" } +{ + "license" : "BSD-3-Clause" +} ``` -You can check [the full list of SPDX license IDs](https://spdx.org/licenses/). -Ideally you should pick one that is +You can check [the full list of SPDX license +IDs](https://spdx.org/licenses/). Ideally you should pick one that is [OSI](https://opensource.org/licenses/alphabetical) approved. -If your package is licensed under multiple common licenses, use an [SPDX license -expression syntax version 2.0 string](https://www.npmjs.com/package/spdx), like this: +If your package is licensed under multiple common licenses, use an [SPDX +license expression syntax version 2.0 +string](https://www.npmjs.com/package/spdx), like this: ```json -{ "license" : "(ISC OR GPL-3.0)" } +{ + "license" : "(ISC OR GPL-3.0)" +} ``` If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use a string value like this one: ```json -{ "license" : "SEE LICENSE IN " } +{ + "license" : "SEE LICENSE IN " +} ``` Then include a file named `` at the top level of the package. -Some old packages used license objects or a "licenses" property containing an -array of license objects: +Some old packages used license objects or a "licenses" property containing +an array of license objects: ```json // Not valid metadata -{ "license" : - { "type" : "ISC" - , "url" : "https://opensource.org/licenses/ISC" +{ + "license" : { + "type" : "ISC", + "url" : "https://opensource.org/licenses/ISC" } } // Not valid metadata -{ "licenses" : - [ - { "type": "MIT" - , "url": "https://www.opensource.org/licenses/mit-license.php" - } - , { "type": "Apache-2.0" - , "url": "https://opensource.org/licenses/apache2.0.php" +{ + "licenses" : [ + { + "type": "MIT", + "url": "https://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "Apache-2.0", + "url": "https://opensource.org/licenses/apache2.0.php" } ] } @@ -155,35 +173,49 @@ array of license objects: Those styles are now deprecated. Instead, use SPDX expressions, like this: ```json -{ "license": "ISC" } +{ + "license": "ISC" +} +``` -{ "license": "(MIT OR Apache-2.0)" } +```json +{ + "license": "(MIT OR Apache-2.0)" +} ``` Finally, if you do not wish to grant others the right to use a private or unpublished package under any terms: ```json -{ "license": "UNLICENSED" } +{ + "license": "UNLICENSED" +} ``` + Consider also setting `"private": true` to prevent accidental publication. ### people fields: author, contributors -The "author" is one person. "contributors" is an array of people. A "person" -is an object with a "name" field and optionally "url" and "email", like this: +The "author" is one person. "contributors" is an array of people. A +"person" is an object with a "name" field and optionally "url" and "email", +like this: ```json -{ "name" : "Barney Rubble" -, "email" : "b@rubble.com" -, "url" : "http://barnyrubble.tumblr.com/" +{ + "name" : "Barney Rubble", + "email" : "b@rubble.com", + "url" : "http://barnyrubble.tumblr.com/" } ``` -Or you can shorten that all into a single string, and npm will parse it for you: +Or you can shorten that all into a single string, and npm will parse it for +you: ```json -"Barney Rubble (http://barnyrubble.tumblr.com/)" +{ + "author": "Barney Rubble (http://barnyrubble.tumblr.com/)" +} ``` Both email and url are optional either way. @@ -193,58 +225,61 @@ npm also sets a top-level "maintainers" field with your npm user info. ### funding You can specify an object containing an URL that provides up-to-date -information about ways to help fund development of your package, or -a string URL, or an array of these: +information about ways to help fund development of your package, or a +string URL, or an array of these: - "funding": { +```json +{ + "funding": { + "type" : "individual", + "url" : "http://example.com/donate" + }, + + "funding": { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + }, + + "funding": "http://example.com/donate", + + "funding": [ + { "type" : "individual", "url" : "http://example.com/donate" - } - - "funding": { + }, + "http://example.com/donateAlso", + { "type" : "patreon", "url" : "https://www.patreon.com/my-account" } - - "funding": "http://example.com/donate" - - "funding": [ - { - "type" : "individual", - "url" : "http://example.com/donate" - }, - "http://example.com/donateAlso", - { - "type" : "patreon", - "url" : "https://www.patreon.com/my-account" - } - ] - + ] +} +``` Users can use the `npm fund` subcommand to list the `funding` URLs of all -dependencies of their project, direct and indirect. A shortcut to visit each -funding url is also available when providing the project name such as: -`npm fund ` (when there are multiple URLs, the first one will be -visited) +dependencies of their project, direct and indirect. A shortcut to visit +each funding url is also available when providing the project name such as: +`npm fund ` (when there are multiple URLs, the first one will +be visited) ### files -The optional `files` field is an array of file patterns that describes -the entries to be included when your package is installed as a -dependency. File patterns follow a similar syntax to `.gitignore`, but -reversed: including a file, directory, or glob pattern (`*`, `**/*`, and such) -will make it so that file is included in the tarball when it's packed. Omitting -the field will make it default to `["*"]`, which means it will include all files. +The optional `files` field is an array of file patterns that describes the +entries to be included when your package is installed as a dependency. File +patterns follow a similar syntax to `.gitignore`, but reversed: including a +file, directory, or glob pattern (`*`, `**/*`, and such) will make it so +that file is included in the tarball when it's packed. Omitting the field +will make it default to `["*"]`, which means it will include all files. -Some special files and directories are also included or excluded regardless of -whether they exist in the `files` array (see below). +Some special files and directories are also included or excluded regardless +of whether they exist in the `files` array (see below). -You can also provide a `.npmignore` file in the root of your package or -in subdirectories, which will keep files from being included. At the -root of your package it will not override the "files" field, but in -subdirectories it will. The `.npmignore` file works just like a -`.gitignore`. If there is a `.gitignore` file, and `.npmignore` is -missing, `.gitignore`'s contents will be used instead. +You can also provide a `.npmignore` file in the root of your package or in +subdirectories, which will keep files from being included. At the root of +your package it will not override the "files" field, but in subdirectories +it will. The `.npmignore` file works just like a `.gitignore`. If there is +a `.gitignore` file, and `.npmignore` is missing, `.gitignore`'s contents +will be used instead. Files included with the "package.json#files" field _cannot_ be excluded through `.npmignore` or `.gitignore`. @@ -276,24 +311,28 @@ Conversely, some files are always ignored: * `node_modules` * `config.gypi` * `*.orig` -* `package-lock.json` (use shrinkwrap instead) +* `package-lock.json` (use + [`npm-shrinkwrap.json`](/configuring-npm/npm-shrinkwrap-json) if you wish + it to be published) ### main -The main field is a module ID that is the primary entry point to your program. -That is, if your package is named `foo`, and a user installs it, and then does -`require("foo")`, then your main module's exports object will be returned. +The main field is a module ID that is the primary entry point to your +program. That is, if your package is named `foo`, and a user installs it, +and then does `require("foo")`, then your main module's exports object will +be returned. -This should be a module ID relative to the root of your package folder. +This should be a module relative to the root of your package folder. -For most modules, it makes the most sense to have a main script and often not -much else. +For most modules, it makes the most sense to have a main script and often +not much else. ### browser If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might -rely on primitives that aren't available in Node.js modules. (e.g. `window`) +rely on primitives that aren't available in Node.js modules. (e.g. +`window`) ### bin @@ -302,35 +341,45 @@ install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.) To use this, supply a `bin` field in your package.json which is a map of -command name to local file name. On install, npm will symlink that file into -`prefix/bin` for global installs, or `./node_modules/.bin/` for local +command name to local file name. On install, npm will symlink that file +into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs. For example, myapp could have this: ```json -{ "bin" : { "myapp" : "./cli.js" } } +{ + "bin": { + "myapp": "./cli.js" + } +} ``` -So, when you install myapp, it'll create a symlink from the `cli.js` script to -`/usr/local/bin/myapp`. +So, when you install myapp, it'll create a symlink from the `cli.js` script +to `/usr/local/bin/myapp`. -If you have a single executable, and its name should be the name -of the package, then you can just supply it as a string. For example: +If you have a single executable, and its name should be the name of the +package, then you can just supply it as a string. For example: ```json -{ "name": "my-program" -, "version": "1.2.5" -, "bin": "./path/to/program" } +{ + "name": "my-program", + "version": "1.2.5", + "bin": "./path/to/program" +} ``` would be the same as this: ```json -{ "name": "my-program" -, "version": "1.2.5" -, "bin" : { "my-program" : "./path/to/program" } } +{ + "name": "my-program", + "version": "1.2.5", + "bin": { + "my-program": "./path/to/program" + } +} ``` Please make sure that your file(s) referenced in `bin` starts with @@ -339,93 +388,88 @@ executable! ### man -Specify either a single file or an array of filenames to put in place for the -`man` program to find. +Specify either a single file or an array of filenames to put in place for +the `man` program to find. If only a single file is provided, then it's installed such that it is the -result from `man `, regardless of its actual filename. For example: +result from `man `, regardless of its actual filename. For +example: ```json -{ "name" : "foo" -, "version" : "1.2.3" -, "description" : "A packaged foo fooer for fooing foos" -, "main" : "foo.js" -, "man" : "./man/doc.1" +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": "./man/doc.1" } ``` -would link the `./man/doc.1` file in such that it is the target for `man foo` +would link the `./man/doc.1` file in such that it is the target for `man +foo` If the filename doesn't start with the package name, then it's prefixed. So, this: ```json -{ "name" : "foo" -, "version" : "1.2.3" -, "description" : "A packaged foo fooer for fooing foos" -, "main" : "foo.js" -, "man" : [ "./man/foo.1", "./man/bar.1" ] +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": [ + "./man/foo.1", + "./man/bar.1" + ] } ``` will create files to do `man foo` and `man foo-bar`. Man files must end with a number, and optionally a `.gz` suffix if they are -compressed. The number dictates which man section the file is installed into. +compressed. The number dictates which man section the file is installed +into. ```json -{ "name" : "foo" -, "version" : "1.2.3" -, "description" : "A packaged foo fooer for fooing foos" -, "main" : "foo.js" -, "man" : [ "./man/foo.1", "./man/foo.2" ] +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": [ + "./man/foo.1", + "./man/foo.2" + ] } ``` + will create entries for `man foo` and `man 2 foo` ### directories -The CommonJS [Packages](http://wiki.commonjs.org/wiki/Packages/1.0) spec details a -few ways that you can indicate the structure of your package using a `directories` -object. If you look at [npm's package.json](https://registry.npmjs.org/npm/latest), -you'll see that it has directories for doc, lib, and man. +The CommonJS [Packages](http://wiki.commonjs.org/wiki/Packages/1.0) spec +details a few ways that you can indicate the structure of your package +using a `directories` object. If you look at [npm's +package.json](https://registry.npmjs.org/npm/latest), you'll see that it +has directories for doc, lib, and man. In the future, this information may be used in other creative ways. -#### directories.lib - -Tell people where the bulk of your library is. Nothing special is done -with the lib folder in any way, but it's useful meta info. - #### directories.bin If you specify a `bin` directory in `directories.bin`, all the files in that folder will be added. -Because of the way the `bin` directive works, specifying both a -`bin` path and setting `directories.bin` is an error. If you want to -specify individual files, use `bin`, and for all the files in an -existing `bin` directory, use `directories.bin`. +Because of the way the `bin` directive works, specifying both a `bin` path +and setting `directories.bin` is an error. If you want to specify +individual files, use `bin`, and for all the files in an existing `bin` +directory, use `directories.bin`. #### directories.man A folder that is full of man pages. Sugar to generate a "man" array by walking the folder. -#### directories.doc - -Put markdown files in here. Eventually, these will be displayed nicely, -maybe, someday. - -#### directories.example - -Put example scripts in here. Someday, it might be exposed in some clever way. - -#### directories.test - -Put your tests in here. It is currently not exposed, but it might be in the -future. - ### repository Specify the place where your code lives. This is helpful for people who @@ -435,72 +479,80 @@ command will be able to find you. Do it like this: ```json -"repository": { - "type" : "git", - "url" : "https://github.com/npm/cli.git" -} - -"repository": { - "type" : "svn", - "url" : "https://v8.googlecode.com/svn/trunk/" +{ + "repository": { + "type": "git", + "url": "https://github.com/npm/cli.git" + } } ``` -The URL should be a publicly available (perhaps read-only) url that can be handed -directly to a VCS program without any modification. It should not be a url to an -html project page that you put in your browser. It's for computers. +The URL should be a publicly available (perhaps read-only) url that can be +handed directly to a VCS program without any modification. It should not +be a url to an html project page that you put in your browser. It's for +computers. -For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same -shortcut syntax you use for `npm install`: +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the +same shortcut syntax you use for `npm install`: ```json -"repository": "npm/npm" +{ + "repository": "npm/npm", -"repository": "github:user/repo" + "repository": "github:user/repo", -"repository": "gist:11081aaa281" + "repository": "gist:11081aaa281", -"repository": "bitbucket:user/repo" + "repository": "bitbucket:user/repo", -"repository": "gitlab:user/repo" + "repository": "gitlab:user/repo" +} ``` -If the `package.json` for your package is not in the root directory (for example -if it is part of a monorepo), you can specify the directory in which it lives: +If the `package.json` for your package is not in the root directory (for +example if it is part of a monorepo), you can specify the directory in +which it lives: ```json -"repository": { - "type" : "git", - "url" : "https://github.com/facebook/react.git", - "directory": "packages/react-dom" +{ + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-dom" + } } ``` ### scripts -The "scripts" property is a dictionary containing script commands that are run -at various times in the lifecycle of your package. The key is the lifecycle -event, and the value is the command to run at that point. +The "scripts" property is a dictionary containing script commands that are +run at various times in the lifecycle of your package. The key is the +lifecycle event, and the value is the command to run at that point. -See [`scripts`](/using-npm/scripts) to find out more about writing package scripts. +See [`scripts`](/using-npm/scripts) to find out more about writing package +scripts. ### config -A "config" object can be used to set configuration parameters used in package -scripts that persist across upgrades. For instance, if a package had the -following: +A "config" object can be used to set configuration parameters used in +package scripts that persist across upgrades. For instance, if a package +had the following: ```json -{ "name" : "foo" -, "config" : { "port" : "8080" } } +{ + "name": "foo", + "config": { + "port": "8080" + } +} ``` and then had a "start" command that then referenced the `npm_package_config_port` environment variable, then the user could override that by doing `npm config set foo:port 8001`. -See [`config`](/using-npm/config) and [`scripts`](/using-npm/scripts) for more on package -configs. +See [`config`](/using-npm/config) and [`scripts`](/using-npm/scripts) for +more on package configs. ### dependencies @@ -509,17 +561,19 @@ version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. -**Please do not put test harnesses or transpilers in your -`dependencies` object.** See `devDependencies`, below. +**Please do not put test harnesses or transpilers or other "development" +time tools in your `dependencies` object.** See `devDependencies`, below. -See [semver](/using-npm/semver) for more details about specifying version ranges. +See [semver](/using-npm/semver) for more details about specifying version +ranges. * `version` Must match `version` exactly * `>version` Must be greater than `version` * `>=version` etc * `=1.0.2 <2.1.2" - , "baz" : ">1.0.2 <=2.3.4" - , "boo" : "2.0.1" - , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0" - , "asd" : "http://asdf.com/asdf.tar.gz" - , "til" : "~1.2" - , "elf" : "~1.2.3" - , "two" : "2.x" - , "thr" : "3.3.x" - , "lat" : "latest" - , "dyl" : "file:../dyl" +{ + "dependencies": { + "foo": "1.0.0 - 2.9999.9999", + "bar": ">=1.0.2 <2.1.2", + "baz": ">1.0.2 <=2.3.4", + "boo": "2.0.1", + "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0", + "asd": "http://asdf.com/asdf.tar.gz", + "til": "~1.2", + "elf": "~1.2.3", + "two": "2.x", + "thr": "3.3.x", + "lat": "latest", + "dyl": "file:../dyl" } } ``` @@ -573,8 +629,8 @@ Git urls are of the form: If `#` is provided, it will be used to clone exactly that commit. If the commit-ish has the format `#semver:`, `` can be any valid semver range or exact version, and npm will look for any tags -or refs matching that range in the remote repository, much as it would for a -registry dependency. If neither `#` or `#semver:` is +or refs matching that range in the remote repository, much as it would for +a registry dependency. If neither `#` or `#semver:` is specified, then `master` is used. Examples: @@ -606,9 +662,9 @@ included. For example: #### Local Paths -As of version 2.0.0 you can provide a path to a local directory that contains a -package. Local paths can be saved using `npm install -S` or -`npm install --save`, using any of these forms: +As of version 2.0.0 you can provide a path to a local directory that +contains a package. Local paths can be saved using `npm install -S` or `npm +install --save`, using any of these forms: ```bash ../foo/bar @@ -629,32 +685,32 @@ in which case they will be normalized to a relative path and added to your } ``` -This feature is helpful for local offline development and creating -tests that require npm installing where you don't want to hit an -external server, but should not be used when publishing packages -to the public registry. +This feature is helpful for local offline development and creating tests +that require npm installing where you don't want to hit an external server, +but should not be used when publishing packages to the public registry. ### devDependencies If someone is planning on downloading and using your module in their -program, then they probably don't want or need to download and build -the external test or documentation framework that you use. +program, then they probably don't want or need to download and build the +external test or documentation framework that you use. -In this case, it's best to map these additional items in a `devDependencies` -object. +In this case, it's best to map these additional items in a +`devDependencies` object. -These things will be installed when doing `npm link` or `npm install` -from the root of a package, and can be managed like any other npm -configuration param. See [`config`](/using-npm/config) for more on the topic. +These things will be installed when doing `npm link` or `npm install` from +the root of a package, and can be managed like any other npm configuration +param. See [`config`](/using-npm/config) for more on the topic. For build steps that are not platform-specific, such as compiling -CoffeeScript or other languages to JavaScript, use the `prepare` -script to do this, and make the required package a devDependency. +CoffeeScript or other languages to JavaScript, use the `prepare` script to +do this, and make the required package a devDependency. For example: ```json -{ "name": "ethopia-waza", +{ + "name": "ethopia-waza", "description": "a delightfully fruity coffee varietal", "version": "1.2.3", "devDependencies": { @@ -667,17 +723,18 @@ For example: } ``` -The `prepare` script will be run before publishing, so that users -can consume the functionality without requiring them to compile it -themselves. In dev mode (ie, locally running `npm install`), it'll -run this script as well, so that you can test it easily. +The `prepare` script will be run before publishing, so that users can +consume the functionality without requiring them to compile it themselves. +In dev mode (ie, locally running `npm install`), it'll run this script as +well, so that you can test it easily. ### peerDependencies In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. -This is usually referred to as a *plugin*. Notably, your module may be exposing -a specific interface, expected and specified by the host documentation. +This is usually referred to as a *plugin*. Notably, your module may be +exposing a specific interface, expected and specified by the host +documentation. For example: @@ -691,34 +748,38 @@ For example: } ``` -This ensures your package `tea-latte` can be installed *along* with the second -major version of the host package `tea` only. `npm install tea-latte` could -possibly yield the following dependency graph: +This ensures your package `tea-latte` can be installed *along* with the +second major version of the host package `tea` only. `npm install +tea-latte` could possibly yield the following dependency graph: ```bash ├── tea-latte@1.3.5 └── tea@2.2.0 ``` -**NOTE: npm versions 1 and 2 will automatically install `peerDependencies` if -they are not explicitly depended upon higher in the dependency tree. In the -next major version of npm (npm@3), this will no longer be the case. You will -receive a warning that the peerDependency is not installed instead.** The -behavior in npms 1 & 2 was frequently confusing and could easily put you into -dependency hell, a situation that npm is designed to avoid as much as possible. +In npm versions 3 through 6, `peerDependencies` were not automatically +installed, and would raise a warning if an invalid version of the peer +dependency was found in the tree. As of npm v7, peerDependencies _are_ +installed by default. -Trying to install another plugin with a conflicting requirement will cause an -error. For this reason, make sure your plugin requirement is as broad as -possible, and not to lock it down to specific patch versions. +Trying to install another plugin with a conflicting requirement may cause +an error if the tree cannot be resolved correctly. For this reason, make +sure your plugin requirement is as broad as possible, and not to lock it +down to specific patch versions. -Assuming the host complies with [semver](https://semver.org/), only changes in -the host package's major version will break your plugin. Thus, if you've worked -with every 1.x version of the host package, use `"^1.0"` or `"1.x"` to express -this. If you depend on features introduced in 1.5.2, use `">= 1.5.2 < 2"`. +Assuming the host complies with [semver](https://semver.org/), only changes +in the host package's major version will break your plugin. Thus, if you've +worked with every 1.x version of the host package, use `"^1.0"` or `"1.x"` +to express this. If you depend on features introduced in 1.5.2, use +`"^1.5.2"`. ### peerDependenciesMeta -When a user installs your package, npm will emit warnings if packages specified in `peerDependencies` are not already installed. The `peerDependenciesMeta` field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. +When a user installs your package, npm will emit warnings if packages +specified in `peerDependencies` are not already installed. The +`peerDependenciesMeta` field serves to provide npm more information on how +your peer dependencies are to be used. Specifically, it allows peer +dependencies to be marked as optional. For example: @@ -738,7 +799,10 @@ For example: } ``` -Marking a peer dependency as optional ensures npm will not emit a warning if the `soy-milk` package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. +Marking a peer dependency as optional ensures npm will not emit a warning +if the `soy-milk` package is not installed on the host. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed. ### bundledDependencies @@ -759,26 +823,28 @@ If we define a package.json like this: "name": "awesome-web-framework", "version": "1.0.0", "bundledDependencies": [ - "renderized", "super-streams" + "renderized", + "super-streams" ] } ``` + we can obtain `awesome-web-framework-1.0.0.tgz` file by running `npm pack`. This file contains the dependencies `renderized` and `super-streams` which can be installed in a new project by executing `npm install -awesome-web-framework-1.0.0.tgz`. Note that the package names do not include -any versions, as that information is specified in `dependencies`. +awesome-web-framework-1.0.0.tgz`. Note that the package names do not +include any versions, as that information is specified in `dependencies`. If this is spelled `"bundleDependencies"`, then that is also honored. ### optionalDependencies -If a dependency can be used, but you would like npm to proceed if it cannot be -found or fails to install, then you may put it in the `optionalDependencies` -object. This is a map of package name to version or url, just like the -`dependencies` object. The difference is that build failures do not cause -installation to fail. Running `npm install --no-optional` will prevent these -dependencies from being installed. +If a dependency can be used, but you would like npm to proceed if it cannot +be found or fails to install, then you may put it in the +`optionalDependencies` object. This is a map of package name to version or +url, just like the `dependencies` object. The difference is that build +failures do not cause installation to fail. Running `npm install +--no-optional` will prevent these dependencies from being installed. It is still your program's responsibility to handle the lack of the dependency. For example, something like this: @@ -809,32 +875,30 @@ Entries in `optionalDependencies` will override entries of the same name in You can specify the version of node that your stuff works on: ```json -{ "engines" : { "node" : ">=0.10.3 <0.12" } } +{ + "engines": { + "node": ">=0.10.3 <15" + } +} ``` And, like with dependencies, if you don't specify the version (or if you specify "\*" as the version), then any version of node will do. -If you specify an "engines" field, then npm will require that "node" be -somewhere on that list. If "engines" is omitted, then npm will just assume -that it works on node. - -You can also use the "engines" field to specify which versions of npm -are capable of properly installing your program. For example: +You can also use the "engines" field to specify which versions of npm are +capable of properly installing your program. For example: ```json -{ "engines" : { "npm" : "~1.0.20" } } +{ + "engines": { + "npm": "~1.0.20" + } +} ``` -Unless the user has set the `engine-strict` config flag, this -field is advisory only and will only produce warnings when your package is installed as a dependency. - -### engineStrict - -**This feature was removed in npm 3.0.0** - -Prior to npm 3.0.0, this feature was used to treat this package as if the -user had set `engine-strict`. It is no longer used. +Unless the user has set the `engine-strict` config flag, this field is +advisory only and will only produce warnings when your package is installed +as a dependency. ### os @@ -842,14 +906,23 @@ You can specify which operating systems your module will run on: ```json -"os" : [ "darwin", "linux" ] +{ + "os": [ + "darwin", + "linux" + ] +} ``` -You can also block instead of allowing operating systems, -just prepend the blocked os with a '!': +You can also block instead of allowing operating systems, just prepend the +blocked os with a '!': ```json -"os" : [ "!win32" ] +{ + "os": [ + "!win32" + ] +} ``` The host operating system is determined by `process.platform` @@ -863,62 +936,62 @@ If your code only runs on certain cpu architectures, you can specify which ones. ```json -"cpu" : [ "x64", "ia32" ] +{ + "cpu": [ + "x64", + "ia32" + ] +} ``` Like the `os` option, you can also block architectures: ```json -"cpu" : [ "!arm", "!mips" ] +{ + "cpu": [ + "!arm", + "!mips" + ] +} ``` The host architecture is determined by `process.arch` -### preferGlobal - -**DEPRECATED** - -This option used to trigger an npm warning, but it will no longer warn. It is -purely there for informational purposes. It is now recommended that you install -any binaries as local devDependencies wherever possible. - ### private -If you set `"private": true` in your package.json, then npm will refuse -to publish it. +If you set `"private": true` in your package.json, then npm will refuse to +publish it. -This is a way to prevent accidental publication of private repositories. If -you would like to ensure that a given package is only ever published to a -specific registry (for example, an internal registry), then use the -`publishConfig` dictionary described below to override the `registry` config -param at publish-time. +This is a way to prevent accidental publication of private repositories. +If you would like to ensure that a given package is only ever published to +a specific registry (for example, an internal registry), then use the +`publishConfig` dictionary described below to override the `registry` +config param at publish-time. ### publishConfig 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, registry or access, so that you can ensure that a given package is not tagged with "latest", published -to the global public registry or that a scoped module is private by default. - -Any config values can be overridden, but only "tag", "registry" and "access" -probably matter for the purposes of publishing. +to the global public registry or that a scoped module is private by +default. -See [`config`](/using-npm/config) to see the list of config options that can be -overridden. +See [`config`](/using-npm/config) to see the list of config options that +can be overridden. ### workspaces The optional `workspaces` field is an array of file patterns that describes -locations within the local file system that the install client should look up -to find each [workspace](/using-npm/workspaces) that needs to be symlinked to -the top level `node_modules` folder. +locations within the local file system that the install client should look +up to find each [workspace](/using-npm/workspaces) that needs to be +symlinked to the top level `node_modules` folder. It can describe either the direct paths of the folders to be used as workspaces or it can define globs that will resolve to these same folders. -In the following example, all folders located inside the folder `./packages` -will be treated as workspaces as long as they have valid `package.json` files -inside them: +In the following example, all folders located inside the folder +`./packages` will be treated as workspaces as long as they have valid +`package.json` files inside them: ```json { @@ -937,20 +1010,20 @@ npm will default some values based on package contents. * `"scripts": {"start": "node server.js"}` - If there is a `server.js` file in the root of your package, then npm - will default the `start` command to `node server.js`. + If there is a `server.js` file in the root of your package, then npm will + default the `start` command to `node server.js`. * `"scripts":{"install": "node-gyp rebuild"}` - If there is a `binding.gyp` file in the root of your package and you have not defined an `install` or `preinstall` script, npm will - default the `install` command to compile using node-gyp. + If there is a `binding.gyp` file in the root of your package and you have + not defined an `install` or `preinstall` script, npm will default the + `install` command to compile using node-gyp. * `"contributors": [...]` - If there is an `AUTHORS` file in the root of your package, npm will - treat each line as a `Name (url)` format, where email and url - are optional. Lines which start with a `#` or are blank, will be - ignored. + If there is an `AUTHORS` file in the root of your package, npm will treat + each line as a `Name (url)` format, where email and url are + optional. Lines which start with a `#` or are blank, will be ignored. ### SEE ALSO diff --git a/deps/npm/docs/content/configuring-npm/package-lock-json.md b/deps/npm/docs/content/configuring-npm/package-lock-json.md index a3083410f7e2a2..4d994bbc8c0a28 100644 --- a/deps/npm/docs/content/configuring-npm/package-lock-json.md +++ b/deps/npm/docs/content/configuring-npm/package-lock-json.md @@ -14,132 +14,223 @@ generate identical trees, regardless of intermediate dependency updates. This file is intended to be committed into source repositories, and serves various purposes: -* Describe a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies. +* Describe a single representation of a dependency tree such that + teammates, deployments, and continuous integration are guaranteed to + install exactly the same dependencies. -* Provide a facility for users to "time-travel" to previous states of `node_modules` without having to commit the directory itself. +* Provide a facility for users to "time-travel" to previous states of + `node_modules` without having to commit the directory itself. -* To facilitate greater visibility of tree changes through readable source control diffs. +* Facilitate greater visibility of tree changes through readable source + control diffs. -* And optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages. +* Optimize the installation process by allowing npm to skip repeated + metadata resolutions for previously-installed packages. -One key detail about `package-lock.json` is that it cannot be published, and it -will be ignored if found in any place other than the toplevel package. It shares -a format with [npm-shrinkwrap.json](/configuring-npm/shrinkwrap-json), which is essentially the same file, but -allows publication. This is not recommended unless deploying a CLI tool or -otherwise using the publication process for producing production packages. +* As of npm v7, lockfiles include enough information to gain a complete + picture of the package tree, reducing the need to read `package.json` + files, and allowing for significant performance improvements. -If both `package-lock.json` and `npm-shrinkwrap.json` are present in the root of -a package, `package-lock.json` will be completely ignored. +### `package-lock.json` vs `npm-shrinkwrap.json` +Both of these files have the same format, and perform similar functions in +the root of a project. -### File Format +The difference is that `package-lock.json` is that it cannot be published, +and it will be ignored if found in any place other than the root project. -#### name +In contrast, [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) allows +publication, and defines the dependency tree from the point encountered. +This is not recommended unless deploying a CLI tool or otherwise using the +publication process for producing production packages. -The name of the package this is a package-lock for. This must match what's in -`package.json`. +If both `package-lock.json` and `npm-shrinkwrap.json` are present in the +root of a project, `npm-shrinkwrap.json` will take precedence and +`package-lock.json` will be ignored. -#### version +### Hidden Lockfiles -The version of the package this is a package-lock for. This must match what's in -`package.json`. +In order to avoid processing the `node_modules` folder repeatedly, npm as +of v7 uses a "hidden" lockfile present in +`node_modules/.package-lock.json`. This contains information about the +tree, and is used in lieu of reading the entire `node_modules` hierarchy +provided that the following conditions are met: -#### lockfileVersion +- All package folders it references exist in the `node_modules` hierarchy. +- No package folders exist in the `node_modules` hierarchy that are not + listed in the lockfile. +- The modified time of the file is at least as recent as all of the package + folders it references. -An integer version, starting at `1` with the version number of this document -whose semantics were used when generating this `package-lock.json`. +That is, the hidden lockfile will only be relevant if it was created as +part of the most recent update to the package tree. If another CLI mutates +the tree in any way, this will be detected, and the hidden lockfile will be +ignored. -#### packageIntegrity +Note that it _is_ possible to manually change the _contents_ of a package +in such a way that the modified time of the package folder is unaffected. +For example, if you add a file to `node_modules/foo/lib/bar.js`, then the +modified time on `node_modules/foo` will not reflect this change. If you +are manually editing files in `node_modules`, it is generally best to +delete the file at `node_modules/.package-lock.json`. -This is a [subresource -integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) value -created from the `package.json`. No preprocessing of the `package.json` should -be done. Subresource integrity strings can be produced by modules like -[`ssri`](https://www.npmjs.com/package/ssri). +As the hidden lockfile is ignored by older npm versions, it does not +contain the backwards compatibility affordances present in "normal" +lockfiles. That is, it is `lockfileVersion: 3`, rather than +`lockfileVersion: 2`. -#### preserveSymlinks +### Handling Old Lockfiles -Indicates that the install was done with the environment variable -`NODE_PRESERVE_SYMLINKS` enabled. The installer should insist that the value of -this property match that environment variable. +When npm detects a lockfile from npm v6 or before during the package +installation process, it is automatically updated to fetch missing +information from either the `node_modules` tree or (in the case of empty +`node_modules` trees or very old lockfile formats) the npm registry. -#### dependencies +### File Format -A mapping of package name to dependency object. Dependency objects have the -following properties: +#### `name` -##### version +The name of the package this is a package-lock for. This will match what's +in `package.json`. -This is a specifier that uniquely identifies this package and should be -usable in fetching a new copy of it. +#### `version` -* bundled dependencies: Regardless of source, this is a version number that is purely for informational purposes. -* registry sources: This is a version number. (eg, `1.2.3`) -* git sources: This is a git specifier with resolved committish. (eg, `git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e`) -* http tarball sources: This is the URL of the tarball. (eg, `https://example.com/example-1.3.0.tgz`) -* local tarball sources: This is the file URL of the tarball. (eg `file:///opt/storage/example-1.3.0.tgz`) -* local link sources: This is the file URL of the link. (eg `file:libs/our-module`) +The version of the package this is a package-lock for. This will match +what's in `package.json`. -##### integrity +#### `lockfileVersion` -This is a [Standard Subresource -Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) for this -resource. +An integer version, starting at `1` with the version number of this +document whose semantics were used when generating this +`package-lock.json`. -* For bundled dependencies this is not included, regardless of source. -* For registry sources, this is the `integrity` that the registry provided, or if one wasn't provided the SHA1 in `shasum`. -* For git sources this is the specific commit hash we cloned from. -* For remote tarball sources this is an integrity based on a SHA512 of - the file. -* For local tarball sources: This is an integrity field based on the SHA512 of the file. +Note that the file format changed significantly in npm v7 to track +information that would have otherwise required looking in `node_modules` or +the npm registry. Lockfiles generated by npm v7 will contain +`lockfileVersion: 2`. -##### resolved +* No version provided: an "ancient" shrinkwrap file from a version of npm + prior to npm v5. +* `1`: The lockfile version used by npm v5 and v6. +* `2`: The lockfile version used by npm v7, which is backwards compatible + to v1 lockfiles. +* `3`: The lockfile version used by npm v7, _without_ backwards + compatibility affordances. This is used for the hidden lockfile at + `node_modules/.package-lock.json`, and will likely be used in a future + version of npm, once support for npm v6 is no longer relevant. -* For bundled dependencies this is not included, regardless of source. -* For registry sources this is path of the tarball relative to the registry - URL. If the tarball URL isn't on the same server as the registry URL then - this is a complete URL. +npm will always attempt to get whatever data it can out of a lockfile, even +if it is not a version that it was designed to support. -##### bundled +#### `packages` -If true, this is the bundled dependency and will be installed by the parent -module. When installing, this module will be extracted from the parent -module during the extract phase, not installed as a separate dependency. +This is an object that maps package locations to an object containing the +information about that package. -##### dev +The root project is typically listed with a key of `""`, and all other +packages are listed with their relative paths from the root project folder. -If true then this dependency is either a development dependency ONLY of the -top level module or a transitive dependency of one. This is false for -dependencies that are both a development dependency of the top level and a -transitive dependency of a non-development dependency of the top level. +Package descriptors have the following fields: -##### optional +* version: The version found in `package.json` -If true then this dependency is either an optional dependency ONLY of the -top level module or a transitive dependency of one. This is false for -dependencies that are both an optional dependency of the top level and a -transitive dependency of a non-optional dependency of the top level. +* resolved: The place where the package was actually resolved from. In + the case of packages fetched from the registry, this will be a url to a + tarball. In the case of git dependencies, this will be the full git url + with commit sha. In the case of link dependencies, this will be the + location of the link target. -All optional dependencies should be included even if they're uninstallable -on the current platform. +* integrity: A `sha512` or `sha1` [Standard Subresource + Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) + string for the artifact that was unpacked in this location. +* link: A flag to indicate that this is a symbolic link. If this is + present, no other fields are specified, since the link target will also + be included in the lockfile. -##### requires +* dev, optional, devOptional: If the package is strictly part of the + `devDependencies` tree, then `dev` will be true. If it is strictly part + of the `optionalDependencies` tree, then `optional` will be set. If it + is both a `dev` dependency _and_ an `optional` dependency of a non-dev + dependency, then `devOptional` will be set. (An `optional` dependency of + a `dev` dependency will have both `dev` and `optional` set.) -This is a mapping of module name to version. This is a list of everything -this module requires, regardless of where it will be installed. The version -should match via normal matching rules a dependency either in our -`dependencies` or in a level higher than us. +* inBundle: A flag to indicate that the package is a bundled dependency. +* hasInstallScript: A flag to indicate that the package has a `preinstall`, + `install`, or `postinstall` script. -##### dependencies +* hasShrinkwrap: A flag to indicate that the package has an + `npm-shrinkwrap.json` file. + +* bin, license, engines, dependencies, optionalDependencies: fields from + `package.json` + +#### dependencies -The dependencies of this dependency, exactly as at the top level. +Legacy data for supporting versions of npm that use `lockfileVersion: 1`. +This is a mapping of package names to dependency objects. Because the +object structure is strictly hierarchical, symbolic link dependencies are +somewhat challenging to represent in some cases. + +npm v7 ignores this section entirely if a `packages` section is present, +but does keep it up to date in order to support switching between npm v6 +and npm v7. + +Dependency objects have the following fields: + +* version: a specifier that varies depending on the nature of the package, + and is usable in fetching a new copy of it. + + * bundled dependencies: Regardless of source, this is a version number + that is purely for informational purposes. + * registry sources: This is a version number. (eg, `1.2.3`) + * git sources: This is a git specifier with resolved committish. (eg, + `git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e`) + * http tarball sources: This is the URL of the tarball. (eg, + `https://example.com/example-1.3.0.tgz`) + * local tarball sources: This is the file URL of the tarball. (eg + `file:///opt/storage/example-1.3.0.tgz`) + * local link sources: This is the file URL of the link. (eg + `file:libs/our-module`) + +* integrity: A `sha512` or `sha1` [Standard Subresource + Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) + string for the artifact that was unpacked in this location. For git + dependencies, this is the commit sha. + +* resolved: For registry sources this is path of the tarball relative to + the registry URL. If the tarball URL isn't on the same server as the + registry URL then this is a complete URL. + +* bundled: If true, this is the bundled dependency and will be installed + by the parent module. When installing, this module will be extracted + from the parent module during the extract phase, not installed as a + separate dependency. + +* dev: If true then this dependency is either a development dependency ONLY + of the top level module or a transitive dependency of one. This is false + for dependencies that are both a development dependency of the top level + and a transitive dependency of a non-development dependency of the top + level. + +* optional: If true then this dependency is either an optional dependency + ONLY of the top level module or a transitive dependency of one. This is + false for dependencies that are both an optional dependency of the top + level and a transitive dependency of a non-optional dependency of the top + level. + +* requires: This is a mapping of module name to version. This is a list of + everything this module requires, regardless of where it will be + installed. The version should match via normal matching rules a + dependency either in our `dependencies` or in a level higher than us. + +* dependencies: The dependencies of this dependency, exactly as at the top + level. ### See also * [npm shrinkwrap](/commands/npm-shrinkwrap) -* [shrinkwrap.json](/configuring-npm/shrinkwrap-json) -* [package-locks](/configuring-npm/package-locks) +* [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) * [package.json](/configuring-npm/package-json) * [npm install](/commands/npm-install) diff --git a/deps/npm/docs/content/configuring-npm/package-locks.md b/deps/npm/docs/content/configuring-npm/package-locks.md deleted file mode 100644 index a456ef8936645d..00000000000000 --- a/deps/npm/docs/content/configuring-npm/package-locks.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: package-locks -section: 5 -description: An explanation of npm lockfiles ---- - -### Description - -Conceptually, the "input" to [`npm install`](/commands/npm-install) is a [package.json](/configuring-npm/package-json), while its -"output" is a fully-formed `node_modules` tree: a representation of the -dependencies you declared. In an ideal world, npm would work like a pure -function: the same `package.json` should produce the exact same `node_modules` -tree, any time. In some cases, this is indeed true. But in many others, npm is -unable to do this. There are multiple reasons for this: - -* different versions of npm (or other package managers) may have been used to install a package, each using slightly different installation algorithms. - -* a new version of a direct semver-range package may have been published since the last time your packages were installed, and thus a newer version will be used. - -* A dependency of one of your dependencies may have published a new version, which will update even if you used pinned dependency specifiers (`1.2.3` instead of `^1.2.3`) - -* The registry you installed from is no longer available, or allows mutation of versions (unlike the primary npm registry), and a different version of a package exists under the same version number now. - -As an example, consider package A: - -```json -{ - "name": "A", - "version": "0.1.0", - "dependencies": { - "B": "<0.1.0" - } -} -``` - -package B: - -```json -{ - "name": "B", - "version": "0.0.1", - "dependencies": { - "C": "<0.1.0" - } -} -``` - -and package C: -```json -{ - "name": "C", - "version": "0.0.1" -} -``` - -If these are the only versions of A, B, and C available in the -registry, then a normal `npm install A` will install: - -```json -A@0.1.0 -`-- B@0.0.1 - `-- C@0.0.1 -``` - -However, if B@0.0.2 is published, then a fresh `npm install A` will -install: - -```bash -A@0.1.0 -`-- B@0.0.2 - `-- C@0.0.1 -``` - -assuming the new version did not modify B's dependencies. Of course, -the new version of B could include a new version of C and any number -of new dependencies. If such changes are undesirable, the author of A -could specify a dependency on B@0.0.1. However, if A's author and B's -author are not the same person, there's no way for A's author to say -that he or she does not want to pull in newly published versions of C -when B hasn't changed at all. - -To prevent this potential issue, npm uses [package-lock.json](/configuring-npm/package-lock-json) or, if present, [npm-shrinkwrap.json](/configuring-npm/shrinkwrap-json). These files are called package locks, or lockfiles. - -Whenever you run `npm install`, npm generates or updates your package lock, -which will look something like this: - -```json -{ - "name": "A", - "version": "0.1.0", - ...metadata fields... - "dependencies": { - "B": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/B/-/B-0.0.1.tgz", - "integrity": "sha512-DeAdb33F+" - "dependencies": { - "C": { - "version": "git://github.com/org/C.git#5c380ae319fc4efe9e7f2d9c78b0faa588fd99b4" - } - } - } - } -} -``` - -This file describes an *exact*, and more importantly *reproducible* -`node_modules` tree. Once it's present, any future installation will base its -work off this file, instead of recalculating dependency versions off -[package.json](/configuring-npm/package-json). - -The presence of a package lock changes the installation behavior such that: - -1. The module tree described by the package lock is reproduced. This means -reproducing the structure described in the file, using the specific files -referenced in "resolved" if available, falling back to normal package resolution -using "version" if one isn't. - -2. The tree is walked and any missing dependencies are installed in the usual -fashion. - -If `preshrinkwrap`, `shrinkwrap` or `postshrinkwrap` are in the `scripts` -property of the `package.json`, they will be executed in order. `preshrinkwrap` -and `shrinkwrap` are executed before the shrinkwrap, `postshrinkwrap` is -executed afterwards. These scripts run for both `package-lock.json` and -`npm-shrinkwrap.json`. For example to run some postprocessing on the generated -file: - -```json - "scripts": { - "postshrinkwrap": "json -I -e \"this.myMetadata = $MY_APP_METADATA\"" - } -``` - -#### Using locked packages - -Using a locked package is no different than using any package without a package -lock: any commands that update `node_modules` and/or `package.json`'s -dependencies will automatically sync the existing lockfile. This includes `npm -install`, `npm rm`, `npm update`, etc. To prevent this update from happening, -you can use the `--no-save` option to prevent saving altogether, or -`--no-shrinkwrap` to allow `package.json` to be updated while leaving -`package-lock.json` or `npm-shrinkwrap.json` intact. - -It is highly recommended you commit the generated package lock to source -control: this will allow anyone else on your team, your deployments, your -CI/continuous integration, and anyone else who runs `npm install` in your -package source to get the exact same dependency tree that you were developing -on. Additionally, the diffs from these changes are human-readable and will -inform you of any changes npm has made to your `node_modules`, so you can notice -if any transitive dependencies were updated, hoisted, etc. - -#### Resolving lockfile conflicts - -Occasionally, two separate npm install will create package locks that cause -merge conflicts in source control systems. As of `npm@5.7.0`, these conflicts -can be resolved by manually fixing any `package.json` conflicts, and then -running `npm install [--package-lock-only]` again. npm will automatically -resolve any conflicts for you and write a merged package lock that includes all -the dependencies from both branches in a reasonable tree. If -`--package-lock-only` is provided, it will do this without also modifying your -local `node_modules/`. - -To make this process seamless on git, consider installing -[`npm-merge-driver`](https://npm.im/npm-merge-driver), which will teach git how -to do this itself without any user interaction. In short: `$ npx -npm-merge-driver install -g` will let you do this, and even works with -pre-`npm@5.7.0` versions of npm 5, albeit a bit more noisily. Note that if -`package.json` itself conflicts, you will have to resolve that by hand and run -`npm install` manually, even with the merge driver. - -### See Also - -* https://medium.com/@sdboyer/so-you-want-to-write-a-package-manager-4ae9c17d9527 -* [package.json](/configuring-npm/package-json) -* [package-lock.json](/configuring-npm/package-lock-json) -* [shrinkwrap.json](/configuring-npm/shrinkwrap-json) -* [npm shrinkwrap](/commands/npm-shrinkwrap) diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html index 4482f6608999f2..8705b442873c05 100644 --- a/deps/npm/docs/output/commands/npm-audit.html +++ b/deps/npm/docs/output/commands/npm-audit.html @@ -271,7 +271,6 @@

Examples

See Also

diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html index 9aa49839f5c095..8361e995b3a161 100644 --- a/deps/npm/docs/output/commands/npm-ci.html +++ b/deps/npm/docs/output/commands/npm-ci.html @@ -193,7 +193,7 @@

Example

See Also

diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index b3991e6400e862..9ba191b1fc5f95 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@

Description

the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm’s source tree will show:

-
npm@7.4.0 /path/to/npm
+
npm@7.4.2 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm-prefix.html b/deps/npm/docs/output/commands/npm-prefix.html index 7424df7aaef9f7..a330dfd1c373cc 100644 --- a/deps/npm/docs/output/commands/npm-prefix.html +++ b/deps/npm/docs/output/commands/npm-prefix.html @@ -141,18 +141,25 @@

npm-prefix

Table of contents

- +

Synopsis

npm prefix [-g]
 

Description

-

Print the local prefix to standard out. This is the closest parent directory +

Print the local prefix to standard output. This is the closest parent directory to contain a package.json file or node_modules directory, unless -g is also specified.

If -g is specified, this will be the value of the global prefix. See npm config for more detail.

+

Example

+
npm prefix
+/usr/local/projects/foo
+
+
npm prefix -g
+/usr/local
+

See Also

  • npm root
  • diff --git a/deps/npm/docs/output/commands/npm-search.html b/deps/npm/docs/output/commands/npm-search.html index c98a22eca01a33..bad81ffa002be5 100644 --- a/deps/npm/docs/output/commands/npm-search.html +++ b/deps/npm/docs/output/commands/npm-search.html @@ -141,7 +141,7 @@

    npm-search

    Table of contents

    - +

    Synopsis

    @@ -152,29 +152,36 @@

    Table of contents

    Description

    Search the registry for packages matching the search terms. npm search performs a linear, incremental, lexically-ordered search through package -metadata for all files in the registry. If color is enabled, it will further -highlight the matches in the results.

    -

    Additionally, using the --searchopts and --searchexclude options paired with -more search terms will respectively include and exclude further patterns. The -main difference between --searchopts and the standard search terms is that the -former does not highlight results in the output and can be used for more -fine-grained filtering. Additionally, both of these can be added to .npmrc for -default search filtering behavior.

    +metadata for all files in the registry. If your terminal has color +support, it will further highlight the matches in the results. This can +be disabled with the config item color

    +

    Additionally, using the --searchopts and --searchexclude options +paired with more search terms will include and exclude further patterns. +The main difference between --searchopts and the standard search terms +is that the former does not highlight results in the output and you can +use them more fine-grained filtering. Additionally, you can add both of +these to your config to change default search filtering behavior.

    Search also allows targeting of maintainers in search results, by prefixing their npm username with =.

    -

    If a term starts with /, then it’s interpreted as a regular expression and -supports standard JavaScript RegExp syntax. A trailing / will be ignored in -this case. (Note that many regular expression characters must be escaped or -quoted in most shells.)

    -

    A Note on caching

    +

    If a term starts with /, then it’s interpreted as a regular expression +and supports standard JavaScript RegExp syntax. In this case search will +ignore a trailing / . (Note you must escape or quote many regular +expression characters in most shells.)

    Configuration

    +

    All of the following can be defined in a .npmrc file, or passed as +parameters to the cli prefixed with -- (e.g. --json)

    description

    • Default: true
    • Type: Boolean
    -

    Used as --no-description, disables search matching in package descriptions and -suppresses display of that field in results.

    +

    color

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Used as --no-color, disables color highlighting of matches in the +results.

    json

    • Default: false
    • @@ -193,9 +200,9 @@

      long

    • Type: Boolean

    Display full package descriptions and other long text across multiple -lines. When disabled (default) search results are truncated to fit -neatly on a single line. Modules with extremely long names will -fall on multiple lines.

    +lines. When disabled (which is the default) the output will +truncate search results to fit neatly on a single line. Modules with +extremely long names will fall on multiple lines.

    searchopts

    • Default: “”
    • @@ -208,28 +215,37 @@

      searchexclude

    • Type: String

    Space-separated options that limit the results from search.

    -

    searchstaleness

    -
      -
    • Default: 900 (15 minutes)
    • -
    • Type: Number
    • -
    -

    The age of the cache, in seconds, before another registry request is made.

    registry

    -

    Search the specified registry for modules. If you have configured npm to point -to a different default registry, such as your internal private module -repository, npm search will default to that registry when searching. Pass a -different registry url such as the default above in order to override this -setting.

    +

    Search the specified registry for modules. If you have configured npm to +point to a different default registry (such as your internal private +module repository), npm search will also default to that registry when +searching.

    +

    A note on caching

    +

    The npm cli caches search results with the same terms and options +locally in its cache. You can use the following to change how and when +the cli uses this cache. See npm cache for more +on how the cache works.

    +

    prefer-online

    +

    Forced staleness checks for cached searches, making the cli look for +updates immediately even for fresh search results.

    +

    prefer-offline

    +

    Bypasses staleness checks for cached. Missing data will still be +requested from the server. To force full offline mode, use offline.

    +

    offline

    +

    Forces full offline mode. Any searches not locally cached will result in +an error.

    See Also

    diff --git a/deps/npm/docs/output/commands/npm-shrinkwrap.html b/deps/npm/docs/output/commands/npm-shrinkwrap.html index 54e413ab750a55..63057cbe952b17 100644 --- a/deps/npm/docs/output/commands/npm-shrinkwrap.html +++ b/deps/npm/docs/output/commands/npm-shrinkwrap.html @@ -149,19 +149,19 @@

    Table of contents

Description

This command repurposes package-lock.json into a publishable -npm-shrinkwrap.json or simply creates a new one. The file created and updated -by this command will then take precedence over any other existing or future -package-lock.json files. For a detailed explanation of the design and purpose -of package locks in npm, see package-locks.

+npm-shrinkwrap.json or simply creates a new one. The file created and +updated by this command will then take precedence over any other existing +or future package-lock.json files. For a detailed explanation of the +design and purpose of package locks in npm, see +package-lock-json.

See Also

diff --git a/deps/npm/docs/output/commands/npm-start.html b/deps/npm/docs/output/commands/npm-start.html index 6f392c99a33318..920e55b4504572 100644 --- a/deps/npm/docs/output/commands/npm-start.html +++ b/deps/npm/docs/output/commands/npm-start.html @@ -141,18 +141,37 @@

npm-start

Table of contents

- +

Synopsis

npm start [-- <args>]
 

Description

-

This runs an arbitrary command specified in the package’s "start" property of -its "scripts" object. If no "start" property is specified on the -"scripts" object, it will run node server.js.

+

This runs a predefined command specified in the "start" property of +a package’s "scripts" object.

+

If the "scripts" object does not define a "start" property, npm +will run node server.js.

+

Note that this is different from the default node behavior of running +the file specified in a package’s "main" attribute when evoking with +node .

As of npm@2.0.0, you can use custom arguments when executing scripts. Refer to npm run-script for more details.

+

Example

+
{
+  "scripts": {
+    "start": "node foo.js"
+  }
+}
+
+
npm start
+
+> npm@x.x.x start
+> node foo.js
+
+(foo.js output would be here)
+
+

See Also

  • npm run-script
  • diff --git a/deps/npm/docs/output/commands/npm-stop.html b/deps/npm/docs/output/commands/npm-stop.html index 6ca7ce0e590dca..defee05689eb97 100644 --- a/deps/npm/docs/output/commands/npm-stop.html +++ b/deps/npm/docs/output/commands/npm-stop.html @@ -141,14 +141,32 @@

    npm-stop

    Table of contents

    - +

    Synopsis

    npm stop [-- <args>]
     

    Description

    -

    This runs a package’s “stop” script, if one was provided.

    +

    This runs a predefined command specified in the “stop” property of a +package’s “scripts” object.

    +

    Unlike with npm start, there is no default script +that will run if the "stop" property is not defined.

    +

    Example

    +
    {
    +  "scripts": {
    +    "stop": "node bar.js"
    +  }
    +}
    +
    +
    npm stop
    +
    +> npm@x.x.x stop
    +> node bar.js
    +
    +(bar.js output would be here)
    +
    +

    See Also

    • npm run-script
    • diff --git a/deps/npm/docs/output/commands/npm-test.html b/deps/npm/docs/output/commands/npm-test.html index cdb6bb6cfc7a59..3a721ab1fff161 100644 --- a/deps/npm/docs/output/commands/npm-test.html +++ b/deps/npm/docs/output/commands/npm-test.html @@ -141,7 +141,7 @@

      npm-test

      Table of contents

      - +

      Synopsis

      @@ -150,7 +150,21 @@

      Table of contents

      aliases: t, tst

      Description

      -

      This runs a package’s “test” script, if one was provided.

      +

      This runs a predefined command specified in the "test" property of +a package’s "scripts" object.

      +

      Example

      +
      {
      +  "scripts": {
      +    "test": "node test.js"
      +  }
      +}
      +
      +
      npm test
      +> npm@x.x.x test
      +> node test.js
      +
      +(test.js output would be here)
      +

      See Also

      • npm run-script
      • diff --git a/deps/npm/docs/output/commands/npm-token.html b/deps/npm/docs/output/commands/npm-token.html index c704357a4b51d6..de92432475e248 100644 --- a/deps/npm/docs/output/commands/npm-token.html +++ b/deps/npm/docs/output/commands/npm-token.html @@ -153,8 +153,8 @@

        Description

        This lets you list, create and revoke authentication tokens.

        • npm token list: -Shows a table of all active authentication tokens. You can request this as -JSON with --json or tab-separated values with --parseable.
        • +Shows a table of all active authentication tokens. You can request +this as JSON with --json or tab-separated values with --parseable.
        +--------+---------+------------+----------+----------------+
         | id     | token   | created    | read-only | CIDR whitelist |
        @@ -175,11 +175,19 @@ 

        Description

        +--------+---------+------------+----------+----------------+
          -
        • npm token create [--read-only] [--cidr=<cidr-ranges>]: -Create a new authentication token. It can be --read-only or accept a list of -CIDR ranges to -limit use of this token to. This will prompt you for your password, and, if you have -two-factor authentication enabled, an otp.
        • +
        • +

          npm token create [--read-only] [--cidr=<cidr-ranges>]: +Create a new authentication token. It can be --read-only, or accept +a list of +CIDR +ranges with which to limit use of this token. This will prompt you for +your password, and, if you have two-factor authentication enabled, an +otp.

          +

          Currently, the cli can not generate automation tokens. Please refer to +the docs +website +for more information on generating automation tokens.

          +
        +----------------+--------------------------------------+
         | token          | a73c9572-f1b9-8983-983d-ba3ac3cc913d |
        @@ -193,10 +201,12 @@ 

        Description

        • npm token revoke <token|id>: -This removes an authentication token, making it immediately unusable. This can accept -both complete tokens (as you get back from npm token create and will -find in your .npmrc) and ids as seen in the npm token list output. -This will NOT accept the truncated token found in npm token list output.
        • +Immediately removes an authentication token from the registry. You +will no longer be able to use it. This can accept both complete +tokens (such as those you get back from npm token create, and those +found in your .npmrc), and ids as seen in the parseable or json +output of npm token list. This will NOT accept the truncated token +found in the normal npm token list output.
      diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html index 0ed6f6fb604bed..c2712db4f730e4 100644 --- a/deps/npm/docs/output/commands/npm-uninstall.html +++ b/deps/npm/docs/output/commands/npm-uninstall.html @@ -141,48 +141,41 @@

      npm-uninstall

      Table of contents

      - +

      Synopsis

      -
      npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
      +
      npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|--no-save]
       
       aliases: remove, rm, r, un, unlink
       

      Description

      This uninstalls a package, completely removing everything npm installed on its behalf.

      -

      Example:

      -
      npm uninstall sax
      -
      +

      It also removes the package from the dependencies, devDependencies, +optionalDependencies, and peerDependencies objects in your +package.json.

      +

      Futher, if you have an npm-shrinkwrap.json or package-lock.json, npm +will update those files as well.

      +

      --no-save will tell npm not to remove the package from your +package.json, npm-shrinkwrap.json, or package-lock.json files.

      +

      --save or -S will tell npm to remove the package from your +package.json, npm-shrinkwrap.json, and package-lock.json files. +This is the default, but you may need to use this if you have for +instance save=false in your npmrc file

      In global mode (ie, with -g or --global appended to the command), -it uninstalls the current package context as a global package.

      -

      npm uninstall takes 3 exclusive, optional flags which save or update -the package version in your main package.json:

      -
        -
      • -

        -S, --save: Package will be removed from your dependencies.

        -
      • -
      • -

        -D, --save-dev: Package will be removed from your devDependencies.

        -
      • -
      • -

        -O, --save-optional: Package will be removed from your optionalDependencies.

        -
      • -
      • -

        --no-save: Package will not be removed from your package.json file.

        -
      • -
      -

      Further, if you have an npm-shrinkwrap.json then it will be updated as -well.

      +it uninstalls the current package context as a global package. +--no-save is ignored in this case.

      Scope is optional and follows the usual rules for scope.

      -

      Examples:

      -
      npm uninstall sax --save
      -npm uninstall @myorg/privatepackage --save
      -npm uninstall node-tap --save-dev
      -npm uninstall dtrace-provider --save-optional
      -npm uninstall lodash --no-save
      +

      Examples

      +
      npm uninstall sax
      +
      +

      sax will no longer be in your package.json, npm-shrinkwrap.json, or +package-lock.json files.

      +
      npm uninstall lodash --no-save
       
      +

      lodash will not be removed from your package.json, +npm-shrinkwrap.json, or package-lock.json files.

      See Also

      • npm prune
      • diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index 599b051e19ad71..75751d3408cfa1 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -145,6 +145,7 @@

        Table of contents

        Synopsis

        +

        To learn more about how the npm registry treats unpublish, see our unpublish policies

        Unpublishing a single version of a package

        npm unpublish [<@scope>/]<pkg>@<version>
         
        @@ -152,16 +153,21 @@

        Unpublishing an entire package

        npm unpublish [<@scope>/]<pkg> --force
         

        Warning

        -

        Consider using the deprecate command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package.

        +

        Consider using the deprecate command instead, +if your intent is to encourage users to upgrade, or if you no longer +want to maintain a package.

        Description

        -

        This removes a package version from the registry, deleting its -entry and removing the tarball.

        -

        If no version is specified, or if all versions are removed then -the root package entry is removed from the registry entirely.

        -

        Even if a package version is unpublished, that specific name and -version combination can never be reused. In order to publish the -package again, a new version number must be used. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed.

        -

        To learn more about how unpublish is treated on the npm registry, see our unpublish policies.

        +

        This removes a package version from the registry, deleting its entry and +removing the tarball.

        +

        The npm registry will return an error if you are not logged +in.

        +

        If you do not specify a version or if you remove all of a package’s +versions then the registry will remove the root package entry entirely.

        +

        Even if you unpublish a package version, that specific name and version +combination can never be reused. In order to publish the package again, +you must use a new version number. If you unpublish the entire package, +you may not publish any new versions of that package until 24 hours have +passed.

        See Also

        diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index de9bf85161d1e0..4533f7947f40f0 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@

        Table of contents

        npm <command> [args]
         

        Version

        -

        7.4.0

        +

        7.4.2

        Description

        npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/configuring-npm/install.html b/deps/npm/docs/output/configuring-npm/install.html index f5452b64fd0fbe..0950fadc17ec92 100644 --- a/deps/npm/docs/output/configuring-npm/install.html +++ b/deps/npm/docs/output/configuring-npm/install.html @@ -145,20 +145,33 @@

        Table of contents

        Description

        -

        To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.

        +

        To publish and install packages to and from the public npm registry, you +must install Node.js and the npm command line interface using either a Node +version manager or a Node installer. We strongly recommend using a Node +version manager to install Node.js and npm. We do not recommend using a +Node installer, since the Node installation process installs npm in a +directory with local permissions and can cause permissions errors when you +run npm packages globally.

        Overview

        Checking your version of npm and Node.js

        -

        To see if you already have Node.js and npm installed and check the installed version, run the following commands:

        +

        To see if you already have Node.js and npm installed and check the +installed version, run the following commands:

        node -v
         npm -v
         

        Using a Node version manager to install Node.js and npm

        -

        Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.

        +

        Node version managers allow you to install and switch between multiple +versions of Node.js and npm on your system so you can test your +applications on multiple versions of npm to ensure they work for users on +different versions.

        OSX or Linux Node version managers

        Using a Node installer to install Node.js and npm

        -

        If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system.

        +

        If you are unable to use a Node version manager, you can use a Node +installer to install both Node.js and npm on your system.

        OS X or Windows Node installers

        -

        If you’re using OS X or Windows, use one of the installers from the Node.js download page. Be sure to install the version labeled LTS. Other versions have not yet been tested with npm.

        +

        If you’re using OS X or Windows, use one of the installers from the +Node.js download page. Be sure to +install the version labeled LTS. Other versions have not yet been +tested with npm.

        Linux or other operating systems Node installers

        -

        If you’re using Linux or another operating system, use one of the following installers:

        +

        If you’re using Linux or another operating system, use one of the following +installers:

        -

        Or see this page to install npm for Linux in the way many Linux developers prefer.

        +

        Or see this page to +install npm for Linux in the way many Linux developers prefer.

        Less-common operating systems

        -

        For more information on installing Node.js on a variety of operating systems, see this page.

        +

        For more information on installing Node.js on a variety of operating +systems, see this page.