From 6e72a5b44667945d54bca39b06e04108b8c7b792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Achim=20K=C3=B6nigs?= Date: Fri, 9 Oct 2026 08:40:50 +0200 Subject: [PATCH] Allow install scripts of js-controller and esbuild for npm >= 12 npm 12 blocks install scripts of dependencies unless they are listed in the "allowScripts" field of package.json. The npm warning about blocked scripts is hidden by --loglevel error. - js-controller's install script runs "setup first", which creates system.config and the _design objects. Without it, "upload admin" fails with 'Cannot find view "system"' and setup aborts. - esbuild 0.11 (used by @alcalzone/esbuild-register, which js-controller uses to start TypeScript adapters) downloads its binary in its install script. Without it, TypeScript adapters fail with "esbuild: Failed to install correctly". Add both to allowScripts in the generated profile package.json. Older npm versions ignore the field. Remote setup uploads the same package.json, so it is covered as well. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01VbBXwNK1HEqo3JfpuhT6k9 --- CHANGELOG.md | 1 + dist/commands/Setup.js | 7 +++++++ src/commands/Setup.ts | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78cdc201..0b96611f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## **WORK IN PROGRESS** +- (Garfonso) Allow the install scripts of js-controller and esbuild with npm >= 12, otherwise the database is not initialized during setup and TypeScript adapters cannot be started - (@Apollon77/@copilot) **BREAKING:** Require Node.js >=20.19.0 <22.0.0 || >=22.13.0 (was >=16.0.0) - (oweitman/Apollon77) Update chokidar and express - (@Apollon77/@copilot) Switch from ts-node to @alcalzone/esbuild-register for TypeScript support to fix conflicts with Node.js experimental TypeScript features diff --git a/dist/commands/Setup.js b/dist/commands/Setup.js index 1ec1b952..6862fe75 100644 --- a/dist/commands/Setup.js +++ b/dist/commands/Setup.js @@ -135,6 +135,13 @@ export class Setup extends CommandBase { version: '1.0.0', private: true, dependencies: this.dependencies, + // npm >= 12 blocks dependency install scripts by default: + // - js-controller needs its install script ("setup first") to create the database + // - esbuild (used by @alcalzone/esbuild-register for TypeScript adapters) downloads its binary + allowScripts: { + 'iobroker.js-controller': true, + esbuild: true, + }, 'dev-server': this.config, }; await writeJson(path.join(this.profilePath, 'package.json'), pkg); diff --git a/src/commands/Setup.ts b/src/commands/Setup.ts index 3ade4bc7..6bc2e3ba 100644 --- a/src/commands/Setup.ts +++ b/src/commands/Setup.ts @@ -153,6 +153,13 @@ export class Setup extends CommandBase { version: '1.0.0', private: true, dependencies: this.dependencies, + // npm >= 12 blocks dependency install scripts by default: + // - js-controller needs its install script ("setup first") to create the database + // - esbuild (used by @alcalzone/esbuild-register for TypeScript adapters) downloads its binary + allowScripts: { + 'iobroker.js-controller': true, + esbuild: true, + }, 'dev-server': this.config, }; await writeJson(path.join(this.profilePath, 'package.json'), pkg);