Environment: Vaadin 25.2.6 (Flow), Maven, Alpine/musl Docker image (Bellsoft liberica-runtime-container:jdk-26-musl), npm 12.0.2
Problem
Since npm 12 removed the long-deprecated --scripts-prepend-node-path config, every production build of a Vaadin 25.2 app fails during build-frontend. Vaadin still passes that flag on the npm install it runs:
using ‘/usr/bin/node …/npm/bin/npm-cli.js --no-update-notifier --no-audit
–scripts-prepend-node-path=true --ignore-scripts install --min-release-age=1’
npm error code EUNKNOWNCONFIG
npm error Unknown cli flag:
npm error - --scripts-prepend-node-path
npm 11 tolerated the flag with a deprecation warning (“this will stop working in the next major version of npm”); npm 12 rejects it outright. So this bites the moment an environment ships npm ≥ 12 — in our case Alpine’s nodejs/npm packages just bumped from 11.x to 12.0.2. It’s not specific to Alpine: anyone with npm 12 gets the same failure.
Vaadin’s own docs say prepare-frontend accepts npm ≥ 11, so npm 12 is within the supported range — but build-frontend’s CLI invocation breaks on it.
Workaround (until Vaadin drops the flag)
Pin npm to 11.x in the build environment. On a normal (glibc) system:
npm install -g npm@11
On Alpine/musl, npm’s default global prefix differs from the apk-installed path that Vaadin invokes, so the prefix must be explicit:
RUN apk add --no-cache nodejs npm && npm install -g --prefix /usr npm@11.19.0
A second issue for Alpine users (related, may be worth a separate thread): Vaadin’s auto-installed Node is the glibc build even on musl images, so it fails to exec on Alpine (Cannot run program …/bin/node: No such file or directory). That means Alpine Docker users can’t simply rely on Vaadin’s managed Node download as a fallback — we have to keep an apk-provided (musl) Node and pin npm ourselves.
Request
Could build-frontend stop passing --scripts-prepend-node-path? It’s been deprecated for several npm majors and removed in npm 12; node is already on PATH for scripts on npm ≥ 7. Alternatively, declare npm 12+ unsupported explicitly in the docs/prepare-frontend version check, since today the supported-version check says 12 is fine and then the build fails.