ENOTCACHED error when building npm package

I am trying to package npm app (owntracks-frontend) using buildNpmPackage.

My package recipe

{ lib
, buildNpmPackage
, fetchFromGitHub
}:

buildNpmPackage rec {
  pname = "owntracks-frontend";
  version = "cecf7e797de7f8bc736a66a94a41b208a0a9a02d";

  src = fetchFromGitHub {
    owner = "owntracks";
    repo = "frontend";
    rev = version;
    hash = "sha256-n+Oqxe7uPHzB0IRdnp8ZWMo1NZtBWlJibXbHxNNke18=";
  };

  npmDepsHash = "sha256-azD9kh4UnxrWbg12Y47vnUnHrRGWpso2vDJWCKc++CQ=";
}

Build fails with following error:

owntracks-frontend-cecf7e797de7f8bc736a66a94a41b208a0a9a02d> Installing dependencies
owntracks-frontend-cecf7e797de7f8bc736a66a94a41b208a0a9a02d> npm ERR! code ENOTCACHED
owntracks-frontend-cecf7e797de7f8bc736a66a94a41b208a0a9a02d> npm ERR! request to https://registry.npmjs.org/yocto-queue failed: cache mode is 'only-if-cached' but no cached response is available.

When trying to build the package manually using npm it works nicely

git clone https://github.com/owntracks/frontend.git

nix shell nixpkgs#nodejs
npm install
npm run build

Any ideas ?

Can you post a more complete log of the build error? This builder generally offers advice on what to do when the build fails.

Running phase: unpackPhase
unpacking source archive /nix/store/miaw56qy1fx5613xyafwx5xa5qxs8y8j-source
source root is source
Running phase: patchPhase
Executing npmConfigHook
Configuring npm
Validating consistency between /build/source/package-lock.json and /nix/store/3jsgk0qfpyw5n74zl27bbm64h6vskgdq-owntracks-frontend-cecf7e797de7f8bc736a66a94a41b208a0a9a02d-npm-deps/package-lock.json
Installing dependencies
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/yocto-queue failed: cache mode is 'only-if-cached' but no cached response is available.

npm ERR! Log files were not written due to an error writing to the directory: /nix/store/3jsgk0qfpyw5n74zl27bbm64h6vskgdq-owntracks-frontend-cecf7e797de7f8bc736a66a94a41b208a0a9a02d-npm-deps/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

ERROR: npm failed to install dependencies

Here are a few things you can try, depending on the error:
1. Set `makeCacheWritable = true`
  Note that this won't help if npm is complaining about not being able to write to the logs directory -- look above that for the actual error.
2. Set `npmFlags = [ "--legacy-peer-deps" ]`

I tried both suggestions without success.

Looks like not up-to-date package-lock.json file. I tried to update it manually using npm update and added it to build in postPatch and it works now.