nix-npm-buildpackage icon indicating copy to clipboard operation
nix-npm-buildpackage copied to clipboard

Feature request: support for npm lockfile version 3

Open hlolli opened this issue 2 years ago • 3 comments

nodejs18 comes with npm 9.x which produces lockfile version 3, which produces

error: nix-npm-buildPackage doesn't support this lock file version

I don't know how heavy lift this will be, I just noticed that there wasn't any ticket here around this upcoming change.

Workaround: just re-enumerate 3 to 2 in the package-lock.json, seems to work.

hlolli avatar Jun 01 '23 14:06 hlolli

I forgot about the implementation, but it depends on how we use the lock-format I think. So first there was V1 and then there was V2, which added a new way to define dependencies but kept the V1 format around. Then now in V3 they dropped the legacy one, so you get a smaller lock file with only the new format.

terlar avatar Jun 01 '23 20:06 terlar

it seems V3 suffers from the same https://github.com/npm/cli/issues/4263 issue as V2. And my workaround to nuke the npm cache and re-fetch everything, is at least on initial attempt, not working. So I do NIXPKGS_ALLOW_INSECURE=1 nix-shell -p nodejs-16_x to regenerate the lockfile then go back as usual to nodejs18.

hlolli avatar Jun 01 '23 21:06 hlolli

A workaround I use is to create an .npmrc that forces the lockfile version to be kept at version 2:

lockfile-version=2

kodeFant avatar Jul 08 '23 21:07 kodeFant