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

Closed

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.

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    on Mar 25, 2026
  2. changed the title [-][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[/+] on Mar 25, 2026
  3. afoley587 commented on Mar 25, 2026

    @afoley587

    I am seeing the same behavior.

    If I upgrade 11.11.0 first, then 11.12.0 successfully installs:

    root@cde9cdd45d71:/# npm install -g "npm@11.11.0"
    
    removed 49 packages, and changed 92 packages in 1s
    
    15 packages are looking for funding
      run `npm fund` for details
    root@cde9cdd45d71:/# npm install -g "npm@11.12.0"
    
    removed 7 packages, and changed 27 packages in 1s
    
    15 packages are looking for funding
      run `npm fund` for details
    root@cde9cdd45d71:/# 

    In the meantime, I am going to pin to 11.11.0 (I assume it pulls in a missing dependency, which then lets 11.12.0 install).

  4. northcutted commented on Mar 25, 2026

    @northcutted

    details

    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.

  5. altbdoor commented on Mar 26, 2026

    @altbdoor

    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.0 is just the one that worked for me, other versions could work as well. So an incremental upgrade works, but a direct npm@latest would fail.

  6. jonseymour commented on Mar 26, 2026

    @jonseymour

    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

  7. added a commit that references this issue on Mar 31, 2026
  8. honwen commented on Apr 2, 2026

    @honwen

    My dockerfile works for me.

    npm install -g npm@11 || npm install -g npm@10 && npm install -g npm@11


    finally:

    # npm -v
    11.12.1
    

    seems install npm@10 can fix missing deps

  9. 100 remaining items

  10. added a commit that references this issue on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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