Vaadin 25.2 production builds fail on npm 12: Unknown cli flag

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.

Even the latest NodeJS (26.8) does not ship with npm 12. So I would personally say: you use an unsupported version. Node.js — Download Node.js®

1 Like

npm 12 is not supported but the flag seems to be pointless in npm 11 also: fix: stop passing --scripts-prepend-node-path to npm by totally-not-ai[bot] · Pull Request #25333 · vaadin/flow · GitHub

1 Like

Good catch. npm 12 breaks the current Vaadin build because of the removed flag. Pinning npm 11 works for now, but Vaadin should remove the deprecated flag for npm 12 compatibility.

1 Like