Debugging a broken npm package

Hi there,

I’m trying to build a pkgs.home-assistant-custom-lovelace-modules package.

The source repo for the npm package itself is here: GitHub - Hypfer/lovelace-valetudo-map-card: Display the map from a valetudo-enabled robot in a home assistant dashboard card.

I’ve looked up similar packages to use as a template, and my code pulls in the source and begins to build dependencies, but then fails with a rather cryptic error message:

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/q3mbhh278j1646dwiyvp7ivvz26ja4na-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
Executing npmConfigHook
Configuring npm
Validating consistency between /build/source/package-lock.json and /nix/store/vra4cxzp96cxvc2z9llprkzpz7kykizy-lovelace-valet>
Making cache writable
Installing dependencies
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@es-joy/jsdoccomment@0.30.0',
npm WARN EBADENGINE   required: { node: '^14 || ^16 || ^17 || ^18' },
npm WARN EBADENGINE   current: { node: 'v20.11.1', npm: '10.2.4' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'eslint-plugin-jsdoc@39.3.0',
npm WARN EBADENGINE   required: { node: '^14 || ^16 || ^17 || ^18' },
npm WARN EBADENGINE   current: { node: 'v20.11.1', npm: '10.2.4' }
npm WARN EBADENGINE }
npm WARN deprecated rollup-plugin-node-resolve@5.2.0: This package has been deprecated and is no longer maintained. Please us>
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @roll>
npm WARN deprecated rollup-plugin-commonjs@10.1.0: This package has been deprecated and is no longer maintained. Please use @>
npm WARN deprecated @formatjs/intl-utils@3.8.4: the package is rather renamed to @formatjs/ecma-abstract with some changes in>
npm ERR! code 1
npm ERR! command failed
npm ERR! command bash -c $prefetchNpmDeps --fixup-lockfile package-lock.json
npm ERR! Error: No such file or directory (os error 2)

npm ERR! A complete log of this run can be found in: /build/cache/_logs/2024-04-02T12_58_31_883Z-debug-0.log

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 >
2. Set `npmFlags = [ "--legacy-peer-deps" ]`
{ lib
, fetchFromGitHub
, buildNpmPackage
}:

buildNpmPackage rec {
  pname = "lovelace-valetudo-map-card";
  version = "2023.04.0";

  src = fetchFromGitHub {
    owner = "Hypfer";
    repo = "lovelace-valetudo-map-card";
    rev = "v${version}";
    hash = "sha256-owOIbA1tRlnbWJ/p/wAUpeDnz/Wzu+GmUammJ6VFxHc=";
  };

  # Needed for eslint-plugin-sort-requires
  forceGitDeps = true;

  makeCacheWritable = true;

  passthru.entrypoint = "valetudo-map-card.js";

  npmDepsHash = "sha256-XqLv4b2XvhKzW3VAYni6Uy36Ud4aBRwFVLOJbq6PheE=";

  installPhase = ''
    runHook preInstall

    mkdir $out
    install -m0644 dist/valetudo-map-card.js $out

    runHook postInstall
  '';

  meta = with lib; {
    changelog = "https://github.com/Hypfer/lovelace-valetudo-map-card/releases/tag/v${version}";
    description = "Display the map from a valetudo-enabled robot in a home assistant dashboard card.";
    homepage = "https://github.com/Hypfer/lovelace-valetudo-map-card";
    license = licenses.mit;
    maintainers = with maintainers; [ johnhamelink ];
  };

}

I’ve tried setting npmFlags = [ "--legacy-peer-deps" ] but that doesn’t help. I’m unsure where the error is coming from - I assume the command not found is in reference to bash?

Any help would be greatly received. Thanks!