Skip to content

fetchNpmDeps may need some fixes for nodejs 24 #474535

Open

Description

@Aleksanaa

In current staging-next (#471587), some packages with buildNpmPackage are failing because npm cannot find some dependencies from cached responses, for example https://hydra.nixos.org/build/317075862

Probably related to nodejs update 22 -> 24: #462407

Activity

  1. Aleksanaa commented on Dec 27, 2025

    @Aleksanaa
    MemberAuthor

    The warnings are not related, but they can probably be fixed by:

    diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
    index d954bb010df2..390f03c09bc1 100644
    --- a/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
    +++ b/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
    @@ -14,10 +14,10 @@ npmConfigHook() {
         echo "Configuring npm"
    
         export HOME="$TMPDIR"
    -    export npm_config_nodedir="@nodeSrc@"
    -    export npm_config_node_gyp="@nodeGyp@"
    -    export npm_config_arch="@npmArch@"
    -    export npm_config_platform="@npmPlatform@"
    +    export npm_package_config_node_gyp_nodedir="@nodeSrc@"
    +    export npm_package_config_node_gyp="@nodeGyp@"
    +    export npm_package_config_node_gyp_arch="@npmArch@"
    +    export npm_package_config_node_gyp_platform="@npmPlatform@"
    
         if [ -z "${npmDeps-}" ]; then
             echo

    But this causes a mass rebuild because gtk4 and some other libraries are affected.

  2. Aleksanaa commented on Dec 27, 2025

    @Aleksanaa
    MemberAuthor
  3. added
    0.kind: build failure
    on Dec 27, 2025
  4. gepbird commented on Dec 27, 2025

    @gepbird
    Contributor

    I can confirm the above: gemini-cli builds with nodejs_22 and that patch fixes the warning, but not the main error.
    This seems to only affect npm specifically, a yarn package like akkoma-fe or a pnpm package like bash-language-server build fine.

    However that patch will cause another failure with nodejs_22, probably those variables need to be changed somewhere else too.

    logs
    gemini-cli> npm error code 1
    gemini-cli> npm error path /build/source/node_modules/keytar
    gemini-cli> npm error command failed
    gemini-cli> npm error command sh -c prebuild-install || npm run build
    gemini-cli> npm error > [email protected] build
    gemini-cli> npm error > node-gyp rebuild
    gemini-cli> npm error prebuild-install warn install EACCES: permission denied, access '/nix/store/f809vh28jcmvl2pqq5c16dkhpcfakciv-gemini-cli-0.22.2-npm-deps'
    gemini-cli> npm error gyp info it worked if it ends with ok
    gemini-cli> npm error gyp info using [email protected]
    gemini-cli> npm error gyp info using [email protected] | linux | x64
    gemini-cli> npm error gyp info find Python using Python version 3.13.11 found at "/nix/store/qzc04a3npl70cyyy6flnnrb2ig3kayxm-python3-3.13.11/bin/python3"
    gemini-cli> npm error gyp http GET https://nodejs.org/download/release/v22.21.1/node-v22.21.1-headers.tar.gz
    gemini-cli> npm error gyp http fetch GET https://nodejs.org/download/release/v22.21.1/node-v22.21.1-headers.tar.gz attempt 1 failed with EAI_AGAIN
    gemini-cli> npm error gyp WARN install got an error, rolling back install
    gemini-cli> npm error gyp ERR! configure error
    gemini-cli> npm error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v22.21.1/node-v22.21.1-headers.tar.gz failed, reason: getaddrinfo EAI_AGAIN nodejs.org
    gemini-cli> npm error gyp ERR! stack at ClientRequest.<anonymous> (/nix/store/h0rwbhyq01dy7yaf2aimbnrbq7p254db-nodejs-22.21.1/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
    gemini-cli> npm error gyp ERR! stack at ClientRequest.emit (node:events:519:28)
    gemini-cli> npm error gyp ERR! stack at emitErrorEvent (node:_http_client:107:11)
    gemini-cli> npm error gyp ERR! stack at _destroy (node:_http_client:954:9)
    gemini-cli> npm error gyp ERR! stack at onSocketNT (node:_http_client:974:5)
    gemini-cli> npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:91:21)
    gemini-cli> npm error gyp ERR! System Linux 6.18.1-zen1
    gemini-cli> npm error gyp ERR! command "/nix/store/h0rwbhyq01dy7yaf2aimbnrbq7p254db-nodejs-22.21.1/bin/node" "/nix/store/h0rwbhyq01dy7yaf2aimbnrbq7p254db-nodejs-22.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gemini-cli> npm error gyp ERR! cwd /build/source/node_modules/keytar
    gemini-cli> npm error gyp ERR! node -v v22.21.1
    gemini-cli> npm error gyp ERR! node-gyp -v v11.2.0
    gemini-cli> npm error gyp ERR! not ok
    gemini-cli> npm error Log files were not written due to an error writing to the directory: /nix/store/f809vh28jcmvl2pqq5c16dkhpcfakciv-gemini-cli-0.22.2-npm-deps/_logs
    gemini-cli> npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

    (I've mostly worked pnpm and not so much with npm, but I'll give this a go.)
    I didn't get too far, tried to find a single npm package that caused this but it was getting tedious. Unlikley, but maybe it has something to do with upstreams using multiple package managers (there was package-lock.json and a yarn.lock in one repo, and package-lock.json and pnpm-workspace.yaml but no pnpm-lock.yaml in another repo). Architecture specific npm packages like @esbuild/linux-x64, @esbuild/darwin-arm64 or optional dependencies could be related.

  5. Scrumplex commented on Dec 27, 2025

    @Scrumplex
    Member

    Node.js 24 updated to NPM 11.x, so it's most certainly some (undocumented?) breaking change from npm.

  6. winterqt commented on Dec 27, 2025

    @winterqt
    Member

    sigh, lovely. I’ll try to take a look at this tomorrow, I am hoping it’s not that bad of a breakage… I’m happier seeing that it’s only a subset of packages though.

  7. changed the title [-][staging-next] fetchNpmDeps may need some fixes for nodejs 24[/-] [+]fetchNpmDeps may need some fixes for nodejs 24[/+] on Dec 31, 2025
  8. winterqt commented on Dec 31, 2025

    @winterqt
    Member

    ^ confirmed that that PR does fix it, have edited the description accordingly so that this'll auto-close

  9. Aleksanaa commented on Dec 31, 2025

    @Aleksanaa
    MemberAuthor

    Looks like npmFlags = [ "--legacy-peer-deps" ]; is the best workaround for now: #475608

    Edit: no it didn't work for some packages

  10. Bad3r commented on Jan 24, 2026

    @Bad3r
    Contributor

    I'm updating the yaak package (2025.6.1 → 2026.1.0) and hit this issue. The nodejs_22 workaround didn't help in this case. It still fails with ENOTCACHED on various packages (cross-spawn, uuid, etc.). The package uses npm workspaces extensively, which seems to trigger this.

    Should I open the PR against staging/staging-next, or wait until this (#470517) lands in master?

    Edit: npmFlags = [ "--legacy-peer-deps" ]; also didn't work in this case.

    Edit: also related to #481866

  11. JohnFlowerful commented on Feb 23, 2026

    @JohnFlowerful

    This issue was a problem with dependency resolution. It was fixed with npm version 11.10.1: npm/cli#8981

  12. TerrorJack commented on Apr 24, 2026

    @TerrorJack
    Member

    this can be closed now that the default npm version is 11.11.0 for nodejs_24, right?

  13. added
    2.status: stale
    on Oct 21, 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

    0.kind: build failure2.status: stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions