Repository navigation
[BUG] latest npm fails to install in latest node 22 (via nvm), node:22 and node:22-slim docker images also #9151
Copy link
Copy link
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
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
The latest node 22 images cannot complete npm install -g npm successfully. I don't see this problem with node 24.
ubuntu@i-03d17c90c782f20f4:~$ sudo podman pull node:22-slim
Trying to pull docker.io/library/node:22-slim...
Getting image source signatures
Copying blob 71ff01535b69 skipped: already exists
Copying blob 6db0909c4473 skipped: already exists
Copying blob eb2c6bc01a10 skipped: already exists
Copying blob 93f73fef6895 skipped: already exists
Copying blob 7723618b139f skipped: already exists
Copying config 08cfc42cb1 done
Writing manifest to image destination
Storing signatures
08cfc42cb10c992db2550ba1d683f105cfbea94a77e5991172428d9a088b492c
ubuntu@i-03d17c90c782f20f4:~$ sudo podman run -it node:22-slim bash
root@0bd2090f26b0:/# npm install -g npm
npm error code MODULE_NOT_FOUND
npm error Cannot find module 'promise-retry'
npm error Require stack:
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js
npm error - /usr/local/lib/node_modules/npm/node_modules/libnpmfund/lib/index.js
npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-output.js
npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-finish.js
npm error - /usr/local/lib/node_modules/npm/lib/commands/install.js
npm error - /usr/local/lib/node_modules/npm/lib/npm.js
npm error - /usr/local/lib/node_modules/npm/lib/cli/entry.js
npm error - /usr/local/lib/node_modules/npm/lib/cli.js
npm error - /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-03-25T17_08_55_019Z-debug-0.log
root@0bd2090f26b0:/# node --version
v22.22.2
root@0bd2090f26b0:/# npm --version
10.9.7
root@0bd2090f26b0:/#
exit
ubuntu@i-03d17c90c782f20f4:~$ sudo podman run -it node:22 bash
Resolved "node" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/node:22...
Getting image source signatures
Copying blob 26fa3468d221 done
Copying blob 9d2f29087bcd done
Copying blob 505954b66245 done
Copying blob 6cf051f1897b done
Copying blob 36b590c4abb3 done
Copying blob 723045965114 done
Copying blob 8d1cb3a93685 done
Copying blob c37c8a409321 done
Copying config 7b7084d9d7 done
Writing manifest to image destination
Storing signatures
root@4e407df9f146:/# npm install -g npm
npm error code MODULE_NOT_FOUND
npm error Cannot find module 'promise-retry'
npm error Require stack:
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js
npm error - /usr/local/lib/node_modules/npm/node_modules/libnpmfund/lib/index.js
npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-output.js
npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-finish.js
npm error - /usr/local/lib/node_modules/npm/lib/commands/install.js
npm error - /usr/local/lib/node_modules/npm/lib/npm.js
npm error - /usr/local/lib/node_modules/npm/lib/cli/entry.js
npm error - /usr/local/lib/node_modules/npm/lib/cli.js
npm error - /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-03-25T17_10_38_076Z-debug-0.log
root@4e407df9f146:/# node --version
v22.22.2
root@4e407df9f146:/# npm --version
10.9.7
Alternatively you can reproduce it with nvm on MacOS Tahoe 26.3.1 (probably not specific to that):
boutell@Thomass-MacBook-Pro:~/apostrophecms/assembly-cloud-tools$ nvm install 22
Downloading and installing node v22.22.2...
Downloading https://nodejs.org/dist/v22.22.2/node-v22.22.2-darwin-arm64.tar.xz...
############################################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v22.22.2 (npm v10.9.7)
boutell@Thomass-MacBook-Pro:~/apostrophecms/assembly-cloud-tools$ node --version
v22.22.2
boutell@Thomass-MacBook-Pro:~/apostrophecms/assembly-cloud-tools$ npm --version
10.9.7
boutell@Thomass-MacBook-Pro:~/apostrophecms/assembly-cloud-tools$ npm install -g npm
npm error code MODULE_NOT_FOUND
npm error Cannot find module 'promise-retry'
npm error Require stack:
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/node_modules/libnpmfund/lib/index.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/utils/reify-output.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/utils/reify-finish.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/commands/install.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/npm.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/cli/entry.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/lib/cli.js
npm error - /Users/boutell/.nvm/versions/node/v22.22.2/lib/node_modules/npm/bin/npm-cli.js
npm error A complete log of this run can be found in: /Users/boutell/.npm/_logs/2026-03-25T17_14_59_688Z-debug-0.log
Expected Behavior
The command should succeed.
Steps To Reproduce
On latest node:22 or node:22-slim, attempt to npm install -g npm
Environment
- npm: 10.9.7 attempting to upgrade itself to latest
- Node.js: 22.22.2
- OS Name: linux
- System Model Name:
- npm config:
pure default
; node bin location = /usr/local/bin/node
; node version = v22.22.2
; npm local prefix = /
; npm version = 10.9.7
; cwd = /
; HOME = /root
; Run `npm config ls -l` to show all defaults.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
Activity
[-][BUG] latest npm fails to install in latest node:22 and node:22-slim docker images[/-][+][BUG] latest npm fails to install in latest node 22 (via nvm), node:22 and node:22-slim docker images also[/+]afoley587 commentedon Mar 25, 2026
I am seeing the same behavior.
If I upgrade
11.11.0first, then11.12.0successfully installs:In the meantime, I am going to pin to
11.11.0(I assume it pulls in a missing dependency, which then lets11.12.0install).northcutted commentedon Mar 25, 2026
Just wanted to say this method worked great for me. I was able to pin 11.11.1 and then upgrade to 11.12.0 without issue.
altbdoor commentedon Mar 26, 2026
Cross posting from the NodeJS issue, but +1 to @afoley587 and @northcutted 's recommendation. In some of the workflows, I have:
# install latest npm + npm install -g npm@~11.10.0 npm install -g npm@latest~11.10.0is just the one that worked for me, other versions could work as well. So an incremental upgrade works, but a directnpm@latestwould fail.fix(tools.func): pin npm to 11.11.0 to work around Node.js 22.22.2 re…
fix(tools.func): pin npm to 11.11.0 to work around Node.js 22.22.2 re…
fix: eagerly require promise-retry to survive self-upgrade
jonseymour commentedon Mar 26, 2026
I also experienced this. Just in case it helps, it happens with node:22-alpline on linux/amd64 but not on linux/arm64. I see a fix is being proposed in #9152
fix: eagerly require promise-retry to survive self-upgrade
Fix `MODULE_NOT_FOUND` error on globally updating npm from 10.9.7 to …
Fix `MODULE_NOT_FOUND` error on globally updating npm from 10.9.7 to …
Pin npm to fix build for Laravel
honwen commentedon Apr 2, 2026
My dockerfile works for me.
npm install -g npm@11 || npm install -g npm@10 && npm install -g npm@11finally:
seems install npm@10 can fix missing deps
100 remaining items
feat: replace make-fetch-happen with built-in fetch (nodejs#3302)
ci(server-rust): two-step npm upgrade (Node 22 npm 10.9.7 self-upgrad…
CI: pin npm via Corepack in publish — fix provenance 'Cannot find mod…
CI: fix publish E404 — Corepack never overrode npm; the publish ran o…
fix(setup): make npm self-upgrade best-effort in setup script (#219)
fix: pin release npm to 11.x so npm ci builds better-sqlite3 (#568)
Tighten cloud env scripts: drop npm self-upgrade, add setup.sh drift …
fix(release): drop broken npm@11 upgrade — bootstrap works on bundled…
chore(release-npm): Trusted Publishing now active
Chore/deps security sdk 1.30 (#52)
fix(ci): pin npm to 11.11.0 to avoid self-upgrade regression
ci: rm npm/cli/issues/9151 workaround
ci: rm npm/cli/issues/9151 workaround
ci: rm npm/cli/issues/9151 workaround