From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 23 Mar 2026 17:01:48 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4hiu-004Aoh-0d for lore@lore.pengutronix.de; Mon, 23 Mar 2026 17:01:48 +0100 Received: from [127.0.0.1] (helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1w4hiu-0000xU-33; Mon, 23 Mar 2026 17:01:48 +0100 Received: from mx08-007fc201.pphosted.com ([91.207.212.40]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1w4hih-0000xG-1m for ptxdist@pengutronix.de; Mon, 23 Mar 2026 17:01:35 +0100 Received: from pps.filterd (m0456229.ppops.net [127.0.0.1]) by mx08-007fc201.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NFsCUK2841005 for ; Mon, 23 Mar 2026 17:01:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cab.de; h= content-id:content-transfer-encoding:content-type:date:from :message-id:mime-version:subject:to; s=pp-2025; bh=JmYygpwG5PYLX FVyvnje0d/2CiFlxmpG0nZdVB/hbbQ=; b=zVgIkUdl4RuRq4oQ7dwfpfyhBU8d7 tmMaySbClLpqzcZiF0uhDYPzaY7ouNR0X3OqY3GnRfTYyF3WDj/SQss7L9+MGqnJ dxvtdVOWAOYOwY+n9wNQi8ssDqKG8UWXmT1V1488ppoKt5tXOGSHnPibHDSyUfKV YbqS6GJZBEi86iDUIiTmVKghTwI8cgZsoWomT8YFRci3Na4RxHVA5sVKChYN1fxP shbCEBMPebGh3KakMUSZk91WWLQLsbRn3E+32mI0Uj6KrMcX4VMF+krycKr++8LQ M8Uodq4m5C1sk967vxWGr/IMW+rEthch/Hgn8Ra+5Fw9Bt3B//DNm73pg== Received: from adranos.cab.de (adranos.cab.de [46.232.229.107]) by mx08-007fc201.pphosted.com (PPS) with ESMTPS id 4d28akrg3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Mar 2026 17:01:33 +0100 (CET) Received: from Adranos.cab.de (10.10.1.54) by Adranos.cab.de (10.10.1.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 23 Mar 2026 17:01:33 +0100 Received: from Adranos.cab.de ([fe80::9298:8fc8:395c:3859]) by Adranos.cab.de ([fe80::9298:8fc8:395c:3859%7]) with mapi id 15.02.2562.037; Mon, 23 Mar 2026 17:01:33 +0100 To: "ptxdist@pengutronix.de" Thread-Topic: Node.js packages handling Thread-Index: AQHcut5RSw+owr9fiUKRCVwbnxtv+Q== Date: Mon, 23 Mar 2026 16:01:32 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.3.180] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMiBTYWx0ZWRfXwfP6wZdch+9f ERZk30dA7S3gn+sQ2TTSpw3tMlmG7JkEbOUgDzbMDmJeqs5tBwSO6s38jSO2dtpkaUs7OZVYblx zBYrIwIonh+kOsZUfac3Wgbu3wkZk68TXWu0lTmePTy2IbgDatFlXQn7j8HzFZGELhtUMBMyI64 KWFnVEpERF0MfSF57RzuSrhl4xkPkCg8bZN1Vbg2t4cxoiplC+2u2v2qCM+22XulIFYRp2IT52M ySkTN9O1+mDLfOITmrhcMPt8T/Esqe4c7c/P68jHq/7YQo9vVUnP7ygEL3jMwGXPb9CSqaYaT2L 1oy7OCfmRc1VPEhwtInD06nZjOZq4nrfxQN9vv8mG4rptqHYoMciN4Lu4kkjSL/5CfazL8z2qAh NzqVsk9AFWiGuMqxI6VXc/dpUXnKgoHtXaH38CrE2X9J20fs17a5znhHHLZhXFe8zV0FTwgfy4x pABx51JBVH5BBkteHyQ== X-Proofpoint-GUID: _wwuB3FdlsGNt10sNyrKV6uBvqa_neuT X-Proofpoint-ORIG-GUID: _wwuB3FdlsGNt10sNyrKV6uBvqa_neuT X-Authority-Analysis: v=2.4 cv=CeoFJbrl c=1 sm=1 tr=0 ts=69c163dd cx=c_pps a=LmW7qmVeM6tFdl5svFU9Cg==:117 a=LmW7qmVeM6tFdl5svFU9Cg==:17 a=xqWC_Br6kY4A:10 a=kldc_9v1VKEA:10 a=kj9zAlcOel0A:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=cWcFGAZ52ywjfBe9x-Am:22 a=fhGH0ZMTm4w8Nt5gLHlq:22 a=jseYi11UbwFfwB0SM9MA:9 a=CjuIK1q_8ugA:10 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.5 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] Node.js packages handling X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Markus Heidelberg via ptxdist Reply-To: ptxdist@pengutronix.de Cc: Markus Heidelberg Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Hi, I started using Node.js, in particular Node-RED, and quickly ran into several problems. So I want to share some experience and am interested in how other users handle specific issues. 1. Size of node_modules/ Are there ways to reduce the size of the /usr/lib/node_module/ directory in rootfs? Currently everything from local_src/nodejs_packages/yarn_cache/ will be installed except the .yarn-metadata.json file existing in each package. I'm not quite sure whether *.map, *.d.ts and *.ts and could be safely removed. 2. "_loc" line in .yarn-metadata.json .yarn-metadata.json created by "yarn add" during "nodejs_packages.compile" stage contains a line with a "_loc" key like this: "_loc": "/home/user/myproject/local_src/nodejs_packages/yarn_cache/v= 6/npm-node-red-4.1.6-2f7a2d4bf2565da191663b2751254e41dabe6d79-integrity/nod= e_modules/node-red/package.json", The value of this key contains an absolute path to the module's package.json. It is not desired to keep such information in the project because - it reveals the username and directory name of the developer - it doesn't match when the repository is cloned by another person or to another location - it might change on adjustments by another person or after changing the development location I don't know what the "_loc" key is used for. Can it be removed without side-effects? I removed it as follows and didn't notice an impact: diff --git a/rules/nodejs_packages.make b/rules/nodejs_packages.make index bf533cc..38c6581 100644 --- a/rules/nodejs_packages.make +++ b/rules/nodejs_packages.make @@ -61,6 +61,8 @@ $(STATEDIR)/nodejs_packages.compile: fi $(call node/env, yarn $(YARN_OPTS) add $(NODEJS_PACKAGES_LIST)) @find $(NODEJS_PACKAGES_CACHE) -type f -name '.yarn-tarball.tgz' -delete +# # remove "_loc" keys containing an absolute path to the module's packag= e.json + @find $(NODEJS_PACKAGES_CACHE) -type f -name '.yarn-metadata.json' -exec= sed -i '/^ *"_loc"/d' {} \; @$(call touch) =20 # -----------------------------------------------------------------------= ----- 3. Patching Node.js packages How do you act if having to patch a Node.js package? It is not possible to use the traditional way with the patches/ directory. I manually fixed the files in the Yarn cache - each duplicate and in all variants (.js, *.min.js). It worked in my simple case, but is not a proper solution. 4. Build failure with precompiled native packages During "nodejs_packages.targetinstall" stage the build aborted because it tries to strip the module of the wrong architecture (x64 instead of arm64) of a precompiled native node package: aarch64-v8a-linux-gnu-strip: Unable to recognise the format of the input= file `.../platform-.../packages/nodejs_packages-0.0.1/usr/lib/node_modules= /@node-rs/bcrypt-linux-x64-gnu/bcrypt.linux-x64-gnu.node' "yarn add" copies the x64 version during "nodejs_packages.compile" stage because the "cpu" field of package.json is compared against the "process.arch" node variable, which contains the host architecture. My workaround was to remove the optional "@node-rs/bcrypt*" packages from local_src/nodejs_packages/yarn.lock (but kept the downloaded packages) and fall back to the JavaScript implementation "bcryptjs". Has anyone experienced the same or a similar issue? I have the feeling it cannot be solved using Yarn v1.x, also the latest release v1.22.22 is two years ago. 5. Intl object missing Node.js is configured using "--with-intl=3Dnone" so it doesn't ship the "Intl" object. This caused a problem in Node-RED, so I wonder whether the configuration without intl is done by intent and which different effects changing this option would have. Markus=