Skip to content

Overrides not propagated into npm-shrinkwrap, causes nix build to fail #8252

@sarahec

Description

@sarahec

[REQUIRED] Environment info

This is an issue building 13.31.[1,2] on nix.

firebase-tools:

nix/NixOS -- happens on Linux and Darwin

Platform:

[REQUIRED] Test case

Update the existing nixpkgs derivation to 13.31.1 and try to build.

[REQUIRED] Steps to reproduce

nix-build -A firebase-tools\

[REQUIRED] Expected behavior

It should build, test, and package the new release.

[REQUIRED] Actual behavior

See See NixOS/nixpkgs#382118 (review)

❯ nix-build -A firebase-tools
this derivation will be built:
  /nix/store/ks3yf0x7jgljpwd86rylxl62iy8sbcf5-firebase-tools-13.31.1.drv
building '/nix/store/ks3yf0x7jgljpwd86rylxl62iy8sbcf5-firebase-tools-13.31.1.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/6m5h6142z34fmwan06sg5vfq0s9nib3i-source
source root is source
Running phase: patchPhase
Executing npmConfigHook
Configuring npm
Validating consistency between /private/tmp/nix-build-firebase-tools-13.31.1.drv-0/source/package-lock.json and /nix/store/ynq87csgm3k1ay9gw6m9yjirp56h70f6-firebase-tools-13.31.1-npm-deps/package-lock.json
Fixing lockfile
Installing dependencies
npm error code ENOTCACHED
npm error request to https://registry.npmjs.org/ajv-formats failed: cache mode is 'only-if-cached' but no cached response is available.
npm error Log files were not written due to an error writing to the directory: /nix/store/ynq87csgm3k1ay9gw6m9yjirp56h70f6-firebase-tools-13.31.1-npm-deps/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

Analysis

  1. Nix preloads the dependencies into a new nix_modules (npm ci --no-scripts) then starts building. If any packages try to download new files to the cache at build time, the build fails.
  2. Support node 22 #8136 added overrides to package.json:
  "overrides": {
    "@angular-devkit/core": {
      "ajv-formats": "3.0.1",
      "ajv": "^8.17.1"
    },
    "node-fetch": {
      "whatwg-url": "^14.0.0"
    }
  }
  1. But these new values weren't added to the npm-shrinkwrap. This triggered the nix-build issue.

P.S. Fix in #8253

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions