Subject: [bug#53414] [PATCH] update Node LTS to 16.13.2

From: Pierre Langlois <[email-masked]>
Date: Sun, 15 May 2022 14:45:16 +0100

Hi!

Ryan Sundberg via Guix-patches via <[email-masked]> writes:

> [[PGP Signed Part:Undecided]]
> Hello all, here is a revised version of zamfofex's patch that inherits
> from node-14. I tried to trim as much fat out as possible in the
> inherited node-(16-)lts, but some of the package arguments were
> divergent in minor ways. I also bumped the version to 16.5.0 in the
> meantime.

The patch LGTM, however when testing it out I wasn't able to build node
packages, I get the following error for example:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build node-string-decoder
...
starting phase `install'
npm info using [email-masked]
npm info using [email-masked]
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/gnu/store/4iqwfsbapa3lhhap1jyg0bry8d1373li-node-16.15.0/lib/node_modules/npm/npmrc Completed in 2ms
npm timing config:load:builtin Completed in 2ms
npm timing config:load:cli Completed in 3ms
npm timing config:load:env Completed in 0ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:/tmp/guix-build-node-string-decoder-1.3.0.drv-0/npm-home-0/.npmrc Completed in 2ms
npm timing config:load:user Completed in 2ms
npm timing config:load:file:/gnu/store/72cb549aap0inzc8d0v959w6z8qz964m-node-string-decoder-1.3.0/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 0ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 11ms
npm timing npm:load:configload Completed in 11ms
npm timing npm:load:setTitle Completed in 0ms
npm timing config:load:flatten Completed in 1ms
npm timing npm:load:display Completed in 5ms
npm timing npm:load:logFile Completed in 4ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 21ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 4ms
npm timing idealTree:userRequests Completed in 42ms
npm timing idealTree:#root Completed in 19ms
npm timing idealTree:node_modules/string_decoder Completed in 3ms
npm timing idealTree:node_modules/string_decoder/node_modules/safe-buffer Completed in 0ms
npm timing idealTree:buildDeps Completed in 24ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 73ms
npm timing reify:loadTrees Completed in 74ms
npm timing reify:diffTrees Completed in 1ms
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 0ms
npm timing reify:trashOmits Completed in 0ms
npm timing reify:loadBundles Completed in 0ms
npm timing reify:audit Completed in 0ms
npm timing reifyNode:node_modules/string_decoder/node_modules/safe-buffer Completed in 8ms
npm timing reifyNode:node_modules/string_decoder Completed in 12ms
npm timing reify:unpack Completed in 13ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 1ms
npm timing build:deps Completed in 1ms
npm timing build:queue Completed in 0ms
npm timing build:links Completed in 1ms
npm timing build Completed in 2ms
npm timing reify:build Completed in 2ms
npm timing reify:trash Completed in 0ms
npm timing command:install Completed in 98ms
npm ERR! Cannot set properties of null (setting 'dev')
npm timing npm Completed in 279ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/guix-build-node-string-decoder-1.3.0.drv-0/npm-home-0/.npm/_logs/2022-05-15T13_47_30_141Z-debug-0.log
error: in phase 'install': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/4iqwfsbapa3lhhap1jyg0bry8d1373li-node-16.15.0/bin/npm" arguments: ("--prefix" "/gnu/store/72cb549aap0inzc8d0v959w6z8qz964m-node-string-decoder-1.3.0" "--global" "--offline" "--loglevel" "info" "--production" "install" "../package.tgz") exit-status: 1 term-signal: #f stop-signal: #f>
phase `install' failed after 0.4 seconds
command "/gnu/store/4iqwfsbapa3lhhap1jyg0bry8d1373li-node-16.15.0/bin/npm" "--prefix" "/gnu/store/72cb549aap0inzc8d0v959w6z8qz964m-node-string-decoder-1.3.0" "--global" "--offline" "--loglevel" "info" "--production" "install" "../package.tgz" failed with status 1
builder for `/gnu/store/6a1vjam7gx0znrr8yngaw2lqld9868l0-node-string-decoder-1.3.0.drv' failed with exit code 1
build of /gnu/store/6a1vjam7gx0znrr8yngaw2lqld9868l0-node-string-decoder-1.3.0.drv failed
View build log at '/var/log/guix/drvs/6a/1vjam7gx0znrr8yngaw2lqld9868l0-node-string-decoder-1.3.0.drv.gz'.
guix build: error: build of `/gnu/store/6a1vjam7gx0znrr8yngaw2lqld9868l0-node-string-decoder-1.3.0.drv' failed
--8<---------------cut here---------------end--------------->8---

I'm a bit clueless as to what's happening, it could be a flavour of this
issue upstream: https://github.com/npm/cli/issues/3847

So hopefully this will be resolved with a new node release, in the
meantime, we could still package node 16 but not make it the default
node for the build-system, WDYT?  I'd suggest to keep the node-lts
pointing to the node-14 version.

Also, as an aside, I'm afraid the patch doesn't allow node to be
cross-compiled, but that's also currently broken on master so we could
fix that as a follow-up IMO.

Thanks for working on this!
Pierre