Skip to content

Commit e20424b

Browse files
committed
fix!: don't install man pages in system locations
BREAKING CHANGE: npm no longer registers man pages with the system when installed globally. `man npm-install` will no longer work, but `npm help install` is unaffected.
1 parent b9332e6 commit e20424b

4 files changed

Lines changed: 9 additions & 100 deletions

File tree

docs/lib/content/configuring-npm/package-json.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,11 @@ See [folders](/configuring-npm/folders#executables) for more info on executables
399399

400400
### man
401401

402-
Specify either a single file or an array of filenames to put in place for the `man` program to find.
402+
> **Note:** As of npm v12, man pages are no longer registered with the system `man` program. This field is retained for backward compatibility with package metadata and tools that consume it, but `man <pkgname>` will not work after a global install. Use `npm help <pkgname>` instead where supported.
403403
404-
If only a single file is provided, then it's installed such that it is the result from `man <pkgname>`, regardless of its actual filename.
404+
Specify either a single file or an array of filenames to include as man pages.
405+
406+
If only a single file is provided, then it corresponds to `man <pkgname>`, regardless of its actual filename.
405407
For example:
406408

407409
```json
@@ -414,7 +416,7 @@ For example:
414416
}
415417
```
416418

417-
would link the `./man/doc.1` file in such that it is the target for `man foo`
419+
would associate the `./man/doc.1` file such that it is the target for `man foo`
418420

419421
If the filename doesn't start with the package name, then it's prefixed.
420422
So, this:
@@ -432,10 +434,10 @@ So, this:
432434
}
433435
```
434436

435-
will create files to do `man foo` and `man foo-bar`.
437+
will correspond to `man foo` and `man foo-bar`.
436438

437439
Man files must end with a number, and optionally a `.gz` suffix if they are compressed.
438-
The number dictates which man section the file is installed into.
440+
The number dictates which man section the file belongs to.
439441

440442
```json
441443
{
@@ -469,7 +471,7 @@ If you want to specify individual files, use `bin`, and for all the files in an
469471
#### directories.man
470472

471473
A folder that is full of man pages.
472-
Sugar to generate a "man" array by walking the folder.
474+
Sugar to generate a "man" array by walking the folder. See the note on [`man`](#man) above: as of npm v12, these are no longer installed into the system `man` path.
473475

474476
### repository
475477

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
"bugs": {
3333
"url": "https://github.com/npm/cli/issues"
3434
},
35-
"directories": {
36-
"doc": "./doc",
37-
"man": "./man"
38-
},
3935
"main": "./index.js",
4036
"bin": {
4137
"npm": "bin/npm-cli.js",

tap-snapshots/test/lib/commands/publish.js.test.cjs

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ Object {
123123
"url": "https://github.com/npm/cli/issues",
124124
},
125125
"description": "a package manager for JavaScript",
126-
"directories": Object {
127-
"doc": "./doc",
128-
"man": "./man",
129-
},
130126
"exports": Object {
131127
".": Array [
132128
Object {
@@ -153,91 +149,6 @@ Object {
153149
],
154150
"license": "Artistic-2.0",
155151
"main": "./index.js",
156-
"man": Array [
157-
"man/man1/npm-access.1",
158-
"man/man1/npm-audit.1",
159-
"man/man1/npm-bugs.1",
160-
"man/man1/npm-cache.1",
161-
"man/man1/npm-ci.1",
162-
"man/man1/npm-completion.1",
163-
"man/man1/npm-config.1",
164-
"man/man1/npm-dedupe.1",
165-
"man/man1/npm-deprecate.1",
166-
"man/man1/npm-diff.1",
167-
"man/man1/npm-dist-tag.1",
168-
"man/man1/npm-docs.1",
169-
"man/man1/npm-doctor.1",
170-
"man/man1/npm-edit.1",
171-
"man/man1/npm-exec.1",
172-
"man/man1/npm-explain.1",
173-
"man/man1/npm-explore.1",
174-
"man/man1/npm-find-dupes.1",
175-
"man/man1/npm-fund.1",
176-
"man/man1/npm-get.1",
177-
"man/man1/npm-help-search.1",
178-
"man/man1/npm-help.1",
179-
"man/man1/npm-init.1",
180-
"man/man1/npm-install-ci-test.1",
181-
"man/man1/npm-install-test.1",
182-
"man/man1/npm-install.1",
183-
"man/man1/npm-link.1",
184-
"man/man1/npm-ll.1",
185-
"man/man1/npm-login.1",
186-
"man/man1/npm-logout.1",
187-
"man/man1/npm-ls.1",
188-
"man/man1/npm-org.1",
189-
"man/man1/npm-outdated.1",
190-
"man/man1/npm-owner.1",
191-
"man/man1/npm-pack.1",
192-
"man/man1/npm-ping.1",
193-
"man/man1/npm-pkg.1",
194-
"man/man1/npm-prefix.1",
195-
"man/man1/npm-profile.1",
196-
"man/man1/npm-prune.1",
197-
"man/man1/npm-publish.1",
198-
"man/man1/npm-query.1",
199-
"man/man1/npm-rebuild.1",
200-
"man/man1/npm-repo.1",
201-
"man/man1/npm-restart.1",
202-
"man/man1/npm-root.1",
203-
"man/man1/npm-run.1",
204-
"man/man1/npm-sbom.1",
205-
"man/man1/npm-search.1",
206-
"man/man1/npm-set.1",
207-
"man/man1/npm-start.1",
208-
"man/man1/npm-stop.1",
209-
"man/man1/npm-team.1",
210-
"man/man1/npm-test.1",
211-
"man/man1/npm-token.1",
212-
"man/man1/npm-trust.1",
213-
"man/man1/npm-undeprecate.1",
214-
"man/man1/npm-uninstall.1",
215-
"man/man1/npm-unpublish.1",
216-
"man/man1/npm-update.1",
217-
"man/man1/npm-version.1",
218-
"man/man1/npm-view.1",
219-
"man/man1/npm-whoami.1",
220-
"man/man1/npm.1",
221-
"man/man1/npx.1",
222-
"man/man5/folders.5",
223-
"man/man5/install.5",
224-
"man/man5/npm-global.5",
225-
"man/man5/npm-json.5",
226-
"man/man5/npmrc.5",
227-
"man/man5/package-json.5",
228-
"man/man5/package-lock-json.5",
229-
"man/man7/config.7",
230-
"man/man7/dependency-selectors.7",
231-
"man/man7/developers.7",
232-
"man/man7/logging.7",
233-
"man/man7/orgs.7",
234-
"man/man7/package-spec.7",
235-
"man/man7/registry.7",
236-
"man/man7/removal.7",
237-
"man/man7/scope.7",
238-
"man/man7/scripts.7",
239-
"man/man7/workspaces.7",
240-
],
241152
"name": "npm",
242153
"readmeFilename": "README.md",
243154
"repository": Object {

test/lib/commands/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ t.test('manifest', async t => {
813813
}
814814
delete manifest.gitHead
815815

816-
manifest.man.sort()
816+
manifest.man?.sort()
817817

818818
t.matchSnapshot(manifest, 'manifest')
819819
})

0 commit comments

Comments
 (0)