Skip to content

docs: add warning against npm update -g for global upgrades#55857

Open
SanskaarUndale21 wants to merge 1 commit intoanthropics:mainfrom
SanskaarUndale21:docs/warn-against-npm-update-global
Open

docs: add warning against npm update -g for global upgrades#55857
SanskaarUndale21 wants to merge 1 commit intoanthropics:mainfrom
SanskaarUndale21:docs/warn-against-npm-update-global

Conversation

@SanskaarUndale21
Copy link
Copy Markdown

@SanskaarUndale21 SanskaarUndale21 commented May 3, 2026

Summary

  • A known bug in certain npm versions causes npm update -g to wipe the entire global node_modules directory, removing npm itself and breaking the Node environment entirely.
  • Users naturally reach for npm update -g @anthropic-ai/claude-code when trying to upgrade, not realising the risk.
  • This PR adds an explicit [!WARNING] callout directly below the npm install command, advising against npm update -g and recommending the safe alternative:
npm install -g @anthropic-ai/claude-code@latest

Closes #55725

Changes

  • README.md: added a GitHub-flavoured-markdown warning block under the NPM (Deprecated) install step.

Test plan

  • Render the README on GitHub and verify the warning callout displays correctly.
  • Confirm no other content is changed.

A known bug in certain npm versions causes `npm update -g` to wipe the
entire global node_modules directory, deleting npm itself. Add an
explicit warning to the npm installation section directing users to use
`npm install -g @anthropic-ai/claude-code@latest` instead.

Fixes anthropics#55725
Copilot AI review requested due to automatic review settings May 3, 2026 19:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an explicit README warning to prevent users from breaking their global Node/npm environment when attempting to upgrade via npm update -g, and directs them to a safe upgrade command.

Changes:

  • Add a GitHub admonition warning under the deprecated npm install instructions.
  • Recommend upgrading with npm install -g @anthropic-ai/claude-code@latest instead of npm update -g.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] Add a warning against using "npm update -g" to upgrade Claude Code

2 participants