From 71da6d96dcdf06893989d0a92362199d1188d123 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Tue, 4 Aug 2026 23:13:12 +0200 Subject: [PATCH] setup_nodejs: bypass npm allowScripts policy globally on npm >=11 --- misc/tools.func | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/misc/tools.func b/misc/tools.func index 369831dc4..e5f09c56a 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -7732,6 +7732,16 @@ setup_nodejs() { fi fi + # npm >=11 skips native-module install/rebuild scripts (better-sqlite3, bcrypt, + # argon2, ...) unless each package is explicitly allowlisted, silently leaving + # native deps unbuilt. Bypass the policy globally instead of allowlisting + # per script. + local npm_major + npm_major=$(npm -v 2>/dev/null | cut -d. -f1) + if [[ "${npm_major:-0}" -ge 11 ]]; then + $STD npm config set dangerously-allow-all-scripts true --location=global 2>/dev/null || true + fi + # Set a safe default heap limit for Node.js builds if not explicitly provided. # Priority: # 1) NODE_OPTIONS (caller/user override)