Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm help json errors on Windows #7374

Open
2 tasks done
mbtools opened this issue Apr 14, 2024 · 0 comments
Open
2 tasks done

[BUG] npm help json errors on Windows #7374

mbtools opened this issue Apr 14, 2024 · 0 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 10.x

Comments

@mbtools
Copy link
Contributor

mbtools commented Apr 14, 2024

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

  1. Any Windows version, npm 8 or higher
  2. Run npm help json
  3. 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:

cli/docs/lib/build.js

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:

image

html:

image

Possible solution:

  • Duplicate also the HTML (might as well duplicate the Markdown)

Environment

  • npm: 10
  • Node.js: 20
  • OS Name: Windows 10
@mbtools mbtools added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Apr 14, 2024
@milaninfy milaninfy added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 10.x
Projects
None yet
Development

No branches or pull requests

2 participants