From e0ef885fde10291e5de2709fab5f80c271bf2353 Mon Sep 17 00:00:00 2001 From: ump45nose Date: Mon, 5 Oct 2026 05:22:09 +0800 Subject: [PATCH 1/2] docs: note that `npm install -g` does not create a local node_modules The `npm install` docs described global mode as installing "the current package context ... as a global package" without saying whether the package's own dependencies are installed locally. Users migrating from npm 6 reported `UNMET DEPENDENCY` after `npm install -g`, because since npm 7 no `node_modules` is created in the current directory. Add a note spelling out that global mode installs the package context itself and that a separate `npm install` is still needed for the local dependencies. Closes: https://github.com/npm/cli/issues/2968 --- docs/lib/content/commands/npm-install.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/lib/content/commands/npm-install.md b/docs/lib/content/commands/npm-install.md index 58ff90566f135..ef150a4390f3e 100644 --- a/docs/lib/content/commands/npm-install.md +++ b/docs/lib/content/commands/npm-install.md @@ -49,6 +49,8 @@ Even if you never publish your package, you can still get a lot of benefits of u In global mode (ie, with `-g` or `--global` appended to the command), it installs the current package context (ie, the current working directory) as a global package. + > NOTE: Global mode installs the current package *context*, not its local `node_modules`. No `node_modules` folder is created in the current directory, so the package's own `dependencies` are not installed alongside it. If you need the same package usable locally as well, run a separate `npm install` in that directory. + By default, `npm install` will install all modules listed as dependencies in [`package.json`](/configuring-npm/package-json). With the `--production` flag (or when the `NODE_ENV` environment variable is set to `production`), npm will not install modules listed in `devDependencies`. From 2ab277cb97cf3ac5d28688349b03f174d320eab6 Mon Sep 17 00:00:00 2001 From: ump45nose <52391318+ump45nose@users.noreply.github.com> Date: Fri, 23 Oct 2026 09:49:06 +0800 Subject: [PATCH 2/2] docs: use one sentence per line in added prose Apply the Markdown conventions from #10108 to this PR's new text only. Preserve wording, links, paragraph boundaries, and Markdown structure. Validation: rendered HTML equivalence (whitespace-normalized), text and scope assertions, and whitespace checks. Full npm/docs tests not run locally. AI-assisted formatting update. --- docs/lib/content/commands/npm-install.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/lib/content/commands/npm-install.md b/docs/lib/content/commands/npm-install.md index ef150a4390f3e..21d4b6f3fdf52 100644 --- a/docs/lib/content/commands/npm-install.md +++ b/docs/lib/content/commands/npm-install.md @@ -49,7 +49,9 @@ Even if you never publish your package, you can still get a lot of benefits of u In global mode (ie, with `-g` or `--global` appended to the command), it installs the current package context (ie, the current working directory) as a global package. - > NOTE: Global mode installs the current package *context*, not its local `node_modules`. No `node_modules` folder is created in the current directory, so the package's own `dependencies` are not installed alongside it. If you need the same package usable locally as well, run a separate `npm install` in that directory. + > NOTE: Global mode installs the current package *context*, not its local `node_modules`. + > No `node_modules` folder is created in the current directory, so the package's own `dependencies` are not installed alongside it. + > If you need the same package usable locally as well, run a separate `npm install` in that directory. By default, `npm install` will install all modules listed as dependencies in [`package.json`](/configuring-npm/package-json).