Trying to fix the broken webtorrent-cli
build and I’ve exhausted all my options trying to build it. Upstream has no package-lock.json
so I generated one (cloned upstream and ran npm install
) and then wrote this derivation:
{
lib,
buildNpmPackage,
fetchFromGitHub,
importNpmLock,
}: buildNpmPackage rec {
pname = "webtorrent-cli";
version = "5.1.3";
src = fetchFromGitHub {
owner = "webtorrent";
repo = "webtorrent-cli";
rev = "refs/tags/v${version}";
hash = "sha256-hSQ3j5t/k50/D2ZGO1Whh3bgZNIVmPYUrBsd9V1YQZc=";
};
npmDeps = importNpmLock {
npmRoot = src;
packageLock = lib.importJSON ./package-lock.json;
};
inherit (importNpmLock) npmConfigHook;
}
Error is:
error: builder for '/nix/store/a7cq262c33cnah4qp7x52xgr4cp4bkis-webtorrent-cli-5.1.3.drv' failed with exit code 1;
last 20 log lines:
> Running phase: unpackPhase
> unpacking source archive /nix/store/y3v7lgcr6ajipgwra1li0si4x3g5ibc3-source
> source root is source
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> no configure script, doing nothing
> Executing npmConfigHook
> Configuring npm
Installing patched package.json/package-lock.json
> Installing dependencies
> npm error code ENOTCACHED
> npm error request to https://registry.npmjs.org/@semantic-release%2fchangelog failed: cache mode is 'only-if-cached' but no cached response is available.
> npm error A complete log of this run can be found in: /private/tmp/nix-build-webtorrent-cli-5.1.3.drv-0/.npm/_logs/2025-01-14T23_33_31_398Z-debug-0.log
>
> ERROR: npm failed to install dependencies
>
> Here are a few things you can try, depending on the error:
> 1. Set `npmFlags = [ "--legacy-peer-deps" ]`
>
For full logs, run 'nix log /nix/store/a7cq262c33cnah4qp7x52xgr4cp4bkis-webtorrent-cli-5.1.3.drv'.
I’ve tried npmFlags = ["--legacy-peer-deps"]
and makeCacheWritable = true
with no change. I’ve also tried postPatch = "cp ${./package-lock.json} package-lock.json
with npmDepsHash = "..."
but I get the same problem with a different dependency. Any ideas?