Skip to content

[BUG] <npm help npm> "Edit this page on GitHub" invalid link #8212

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

Closed
2 tasks done
realyoterry opened this issue Apr 7, 2025 · 5 comments · Fixed by #8293
Closed
2 tasks done

[BUG] <npm help npm> "Edit this page on GitHub" invalid link #8212

realyoterry opened this issue Apr 7, 2025 · 5 comments · Fixed by #8293
Labels
Bug thing that needs fixing Good First Issue good issue or PR for newcomers Priority 2 secondary priority issue

Comments

@realyoterry
Copy link

realyoterry commented Apr 7, 2025

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

When I type > npm help npm in cmd, scroll right down and click "Edit this page on GitHub", it opens up https://github.com/npm/cli/edit/latest/docs/content/commands/npm.md which is invalid.

Image

Expected Behavior

I expected the link to work. The link should go to: https://github.com/npm/cli/blob/latest/docs/lib/content/commands/npm.md

Steps To Reproduce

  1. Windows 11 / npm 10.9.2
  2. Type npm help npm in command prompt / terminal
  3. Scroll all the way down to the "Edit this page on GitHub" link
  4. Click on it.

Environment

  • npm: 10.9.2
  • Node.js: v22.14.0
  • OS Name: Windows 11 24H2
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\thete\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.14.0
; npm local prefix = C:\Users\thete
; npm version = 10.9.2
; cwd = C:\Users\thete
; HOME = C:\Users\thete
; Run `npm config ls -l` to show all defaults.
@realyoterry realyoterry added Bug thing that needs fixing Needs Triage needs review for next steps labels Apr 7, 2025
@milaninfy milaninfy added the Documentation documentation related issue label Apr 7, 2025
@milaninfy milaninfy added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Apr 30, 2025
@milaninfy
Copy link
Contributor

milaninfy commented Apr 30, 2025

@realyoterry Thank you for this report

Reproduced locally, when running npm help install --viewer=browser the page it opens is not correctly pointing for "edit this on github" specifically ran from CLI, The actual documentation website works fine.

@milaninfy milaninfy removed the Documentation documentation related issue label Apr 30, 2025
@owlstronaut owlstronaut self-assigned this Apr 30, 2025
@owlstronaut owlstronaut removed their assignment May 1, 2025
@owlstronaut
Copy link
Contributor

Quick look shows that when served from localhost, the edit page is generated without the /lib/ folder. The change we need will be in the gatsby-node.js file https://github.com/npm/documentation/blob/main/gatsby-node.mjs#L182-L185

@milaninfy
Copy link
Contributor

milaninfy commented May 1, 2025

I think the main documentation website is opening link correctly.. it could be an issue when locally installed docs pages is missing the /lib/ folder in path on edit with github links.

This is the path when I ran npm help npm --viewer=browser on mac and npm help npm on cmd (windows)
file:///Users/<my user name>/.nvm/versions/node/v22.14.0/lib/node_modules/npm/docs/output/commands/npm.html implying it's opened from installed npm's documentation

@owlstronaut
Copy link
Contributor

Yep, that makes it pretty low priority, but shouldn't be difficult for someone with the time

@owlstronaut owlstronaut added the Good First Issue good issue or PR for newcomers label May 1, 2025
@devdesiignn
Copy link

Is this issue still open?

wraithgar pushed a commit that referenced this issue May 14, 2025
Fixed `github_path` to correctly link to the GitHub edit page.

## References
 Fixes #8212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Good First Issue good issue or PR for newcomers Priority 2 secondary priority issue
Projects
None yet
4 participants