Skip to content

node in dependencies breaks the build via flake.nix #745

@morphqdd

Description

@morphqdd

When attempting to fix this issue, I encountered a problem where, when loading dependencies using flake.nix via nix build, the build breaks and crashes with this error:

error: builder for '/nix/store/ka1vcwkryawilkdayzvm1nivjd13pb3i-eolang-0.0.0.drv' failed with exit code 1;
       last 25 log lines:
       > npm error command sh -c node installArchSpecificPackage
       > npm error npm error code ENOTCACHED
       > npm error npm error request to https://registry.npmjs.org/node-bin-setup failed: cache mode is 'only-if-cached' but no cached response is available.
       > npm error npm error A complete log of this run can be found in: /build/.npm/_logs/2025-10-25T20_58_46_899Z-debug-0.log
       > npm error node:internal/modules/cjs/loader:1386
       > npm error   throw err;
       > npm error   ^
       > npm error
       > npm error Error: Cannot find module 'node-linux-x64/package.json'
       > npm error Require stack:
       > npm error - /build/patched-src/node_modules/node/installArchSpecificPackage.js
       > npm error     at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
       > npm error     at Function.resolve (node:internal/modules/helpers:157:19)
       > npm error     at ChildProcess.<anonymous> (/build/patched-src/node_modules/node-bin-setup/index.js:20:27)
       > npm error     at ChildProcess.emit (node:events:519:28)
       > npm error     at maybeClose (node:internal/child_process:1101:16)
       > npm error     at ChildProcess._handle.onexit (node:internal/child_process:304:5) {
       > npm error   code: 'MODULE_NOT_FOUND',
       > npm error   requireStack: [
       > npm error     '/build/patched-src/node_modules/node/installArchSpecificPackage.js'
       > npm error   ]
       > npm error }
       > npm error
       > npm error Node.js v22.19.0
       > npm error A complete log of this run can be found in: /build/.npm/_logs/2025-10-25T20_58_45_945Z-debug-0.log
       For full logs, run:
         nix log /nix/store/ka1vcwkryawilkdayzvm1nivjd13pb3i-eolang-0.0.0.drv
error: 1 dependencies of derivation '/nix/store/gxarg75v9h4arch8cjdd2bk3bnf399kn-eoc.drv' failed to build

Why is the node package needed in the dependencies section of the package.json file if nodejs is already required for installation via npm?
However, if you remove node from the dependencies, the download is successful and attempts to compile anything are also successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions