Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
npm checks devEngines before every command run inside a project.
In a project whose devEngines.packageManager names another package manager, npx, npm exec, npm config get and npm view all exit with EBADDEVENGINES, though none of them act on the project.
The gate in lib/npm.js reads the wrong property:
if (commandInstance.checkDevEngines && !this.global) {
await commandInstance.checkDevEngines()
}commandInstance.checkDevEngines is the method BaseCommand defines, so every command has it and the condition is always true.
The opt-in is the static checkDevEngines flag.
BaseCommand sets it to false, only ArboristCmd and run set it to true, and nothing reads it.
The gate has read the instance since #7766 added it, and that PR describes the check as being for "specific npm commands install, and run".
We hit this through MCP servers.
Claude Code starts stdio MCP servers with npx from the project folder, so once our repo pinned pnpm in devEngines, every npx-launched server failed to start there.
Expected Behavior
Only commands that opt in through the static flag check devEngines.
That is the ArboristCmd commands (install, ci, update, ls and the rest) and run, which test, start, stop and restart go through.
The package.json docs say the check "will run before install, ci, and run commands".
npx, npm exec, npm config and npm view should run.
I have a fix with tests and will open a PR.
Steps To Reproduce
mkdir devengines-repro && cd devengines-repro
echo '{ "devEngines": { "packageManager": { "name": "pnpm" } } }' > package.json
npx -y cowsay hi
npm config get registryBoth commands exit 1 with:
npm error code EBADDEVENGINES
npm error EBADDEVENGINES The developer of this package has specified the following through devEngines
npm error EBADDEVENGINES Invalid devEngines.packageManager
npm error EBADDEVENGINES Invalid name "pnpm" does not match "npm" for "packageManager"
npm error EBADDEVENGINES {
npm error EBADDEVENGINES current: { name: 'npm', version: '12.2.2' },
npm error EBADDEVENGINES required: { name: 'pnpm' }
npm error EBADDEVENGINES }
Setting npm_config_force=true turns the error into a warning, and npx --prefix <a folder without devEngines> avoids it.
Environment
- npm: 12.2.2, also 11.20.0
- Node.js: 26.13.1
- OS Name: Arch Linux
- System Model Name: n/a
- npm config:
; defaults, the repro sets nothing
Activity
eran132 commentedon Nov 15, 2026
Same root cause hits GitHub Actions users:
actions/setup-noderunsnpm config get cachein the workspace to set up caching, so any project whosedevEngines.packageManagerrequires a newer npm than the one bundled with Node fails at that step, before the workflow can install the required npm (actions/setup-node#1553, fix in progress in actions/setup-node#1663).Reproduced the always-on gate on 10.9.9, 11.19.1 and 12.2.2 with
devEngines.packageManager>=99and, separately,devEngines.runtime>=30:npm config get cacheexits withEBADDEVENGINESin both cases, while the docs scope the check toinstall,ciandrun.