[BUG] Every command checks devEngines, so npx fails in a project that pins another package manager
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- cli
Línea de trabajo
Start with the reproduction in the issue: a throwaway project whose package.json pins devEngines.packageManager to pnpm, then run npx -y cowsay hi and npm config get registry to see EBADDEVENGINES. The gate is in lib/npm.js and tests commandInstance.checkDevEngines, the instance method every BaseCommand has; the intended opt-in is the static checkDevEngines flag that BaseCommand sets to false and only ArboristCmd and run set to true. Done looks like npx, npm exec, npm config and npm view running normally while install, ci and run still check, matching the wording in docs/lib/content/configuring-npm/package-json.md. Note a fix with tests is already proposed in #10302, so coordinate before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 registry
Both 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
- Lenguaje dominante
- JavaScript
- Estrellas
- 10.3k
- Forks
- 5k
- Merge medio
- 4 d 11 h
- PR fusionados (30 d)
- 26
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de npm/cli
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 2 días
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endingsPosiblemente ocupada @saruk-vedant la tomó hace 7 días. AbiertoBug Needs Triage Triage Requested
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
npm/cli#10316 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyPosiblemente ocupada @drawliin la tomó hace 42 días. Abiertocmd:delete Priority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 2 días
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoEngineering Priority 1
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Los mantenedores suelen responder en 2 días
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysPosiblemente ocupada @greenlincoln05 la tomó hace 63 días. AbiertoPriority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
npm/cli#10018 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Issues similares
-
docs: add SECURITY.md vulnerability reporting policyPosiblemente ocupada @AK-Lmn la tomó hoy. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
flisk-sh/linux2wasm#12 ·
Los mantenedores suelen responder en 1 día
-
possible bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Mintplex-Labs/anything-llm#7388 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día
-
v6: Minified bootstrap.min.css is missing header infoPosiblemente ocupada @lazerg la tomó hoy. Abiertobug build confirmed has-pr v6
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
[workshop-sync] workshop/side-quest-26-01-forecast-costs.md: forecast default history window is inaccuratePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodocumentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
githubnext/gh-aw-workshop#6332 ·
Los mantenedores suelen responder en 1 día