Skip to content

[BUG] latest npm fails to install in latest node 22 (via nvm), node:22 and node:22-slim docker images also #9151

@boutell

Description

@boutell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions