-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issueRelease 10.x
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
On Linux, npm help json
displays correctly man/man5/npm-json
.
On Windows, npm help json
attempts to display the corresponding HTML page which leads to the following error:
PS C:\GitHub\npm\cli> npm help json
npm ERR! code 1
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c start "" file:///C:^%5Cnvm^%5Cv20.11.1^%5Cnode_modules^%5Cnpm^%5Cdocs^%5Coutput^%5Cconfiguring-npm^%5Cnpm-json.html
npm ERR! The system cannot find the file file:///C:%5Cnvm%5Cv20.11.1%5Cnode_modules%5Cnpm%5Cdocs%5Coutput%5Cconfiguring-npm%5Cnpm-json.html.
npm help global
has the same problem.
Expected Behavior
npm help json
and npm help global
should display the same documentation on Windows as on Linux
Steps To Reproduce
- Any Windows version, npm 8 or higher
- Run
npm help json
- See error
Cause:
The build process duplicates two man pages (package-json
-> npm-json
, folders
-> npm-global
). However, it does not duplicate the html
pages. Therefore, npm help json
won't find any HTML version of the duplicated man pages:
Lines 96 to 118 in 9622597
if (data.section) { | |
const manSrc = applyTransforms(transformedSrc, [ | |
transform.helpLinks, | |
transform.man, | |
]) | |
const manPaths = [ | |
name, | |
fullName === 'configuring-npm/package-json' && 'npm-json', | |
fullName === 'configuring-npm/folders' && 'npm-global', | |
].filter(Boolean).map(p => applyTransforms(p, [transform.manPath])) | |
acc.man.push(...manPaths.map((manPath) => ({ | |
path: manPath, | |
fullPath: join(man, manPath), | |
src: manSrc, | |
}))) | |
} | |
acc.html.push({ | |
path: `${fullName}.html`, | |
fullPath: join(html, `${fullName}.html`), | |
src: applyTransforms(transformedSrc, [transform.html]), | |
}) |
man:
html:
Possible solution:
- Duplicate also the HTML (might as well duplicate the Markdown)
Environment
- npm: 10
- Node.js: 20
- OS Name: Windows 10
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issueRelease 10.x