[BUG] Updating global npm to 11.5.2 corrupts installation on Windows
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
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
When updating the global npm package from version 11.5.1 to 11.5.2 using the command npm install -g npm@11.5.2 on Windows, the npm installation becomes corrupted. The update command itself reports success ("added 1 package"), but any subsequent npm command fails with a MODULE_NOT_FOUND error.
The error log indicates a malformed path lookup:
Error: Cannot find module 'C:\Users\Yox\AppData\Roaming\npm\node_modules\npm\bin\node_modules\npm\bin\npm-prefix.js'
Expected Behavior
The command npm install -g npm@11.5.2 should successfully update the global npm package from version 11.5.1 to 11.5.2. After the update, running npm -v should correctly report 11.5.2 and all other npm commands should function normally.
Steps To Reproduce
- Install latest version of Nodejs
winget install nodejs - Verify the current npm version by running
npm -v. It should output11.5.1. - Run the global update command for a specific newer version:
npm install -g npm@11.5.2. - Observe that the command reports success (e.g., "added 1 package").
- Attempt to check the npm version again by running
npm -v. - Observe that the command now fails with the
MODULE_NOT_FOUNDerror.
Environment
-
npm -v:
- Before update:
11.5.1 - After update: Command fails with
MODULE_NOT_FOUND.
- Before update:
-
node -v:
v24.5.0 -
OS:
Windows 11 Pro Insider Preview x86_64 (Build 27909.1000) -
Host:
ASUS ROG Strix G733ZW -
CPU:
12th Gen Intel Core i9-12900H -
GPU:
NVIDIA GeForce RTX 3070 Ti Laptop GPU -
Shell:
PowerShell 7.5.2 -
Terminal:
Windows Terminal 1.22.12111.0 -
npm config ls (before update):
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc prefix = "C:\\Users\\Yox\\AppData\\Roaming\\npm" ; node bin location = C:\Program Files\nodejs\node.exe ; node version = v24.5.0 ; npm local prefix = C:\Users\Yox ; npm version = 11.5.1 ; cwd = C:\Users\Yox ; HOME = C:\Users\Yox ; Run `npm config ls -l` to show all defaults. -
npm config ls (after update):
- This command fails with the same
MODULE_NOT_FOUNDerror.
- This command fails with the same
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with npm install -g npm@11.5.2 on Windows, then inspect the npm CLI's global installation and Windows path-handling entry points. Done means the update completes without corrupting the installation, npm -v reports 11.5.2, and subsequent npm commands no longer produce the MODULE_NOT_FOUND path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100