npm backend install fails when the project package.json declares a non-npm devEngines.packageManager with onFail: "error"
#10492
Replies: 2 comments
-
|
It's npm enforcing your Workaround that keeps |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the clear report and repro — this was helpful. Opened a fix in #10927: mise-owned Worth noting: This comment was generated by an AI coding assistant. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
The
npm:backend fails to install/resolve a tool when the surrounding project'spackage.jsondeclares adevEngines.packageManager(ordevEngines.runtime) that isn't npm/node and setsonFail: "error".mise's npm backend resolves versions by shelling out to the system
npmCLI (npm view <pkg> dist-tags --json,npm view <pkg> versions time --json). npm reads the nearestpackage.jsonand enforces itsdevEngines. This means that if a project declares a devDependency for bun with onFail: "error" then every call tonpmin that project exits non-zero withEBADDEVENGINESsomise use npm:<pkg>/mise install npm:<pkg>fail.Steps to reproduce
Output (trimmed):
Expected behavior
Installing a tool through the
npm:backend should not be blocked by the surrounding project'sdevEngines.packageManager/devEngines.runtimepolicy. mise's npm-backed tools are mise-managed dev tooling, conceptually separate from how the project manages its own dependencies. A project that requires contributors to usebunshould still be able tomise use npm:<some-cli>.Suggested fix
Run the npm backend's internal
npminvocations from a neutral working directory (or pass--prefix) so npm doesn't pick up the project'sdevEngines. Pointing npm at a directory without the projectpackage.jsonmakes the same call succeed.Note that the
npmflag--no-engine-strict/.npmrcsettingnpm_config_engine_strict=falsedoes not help since that gatesengines, notdevEngines.Workarounds
devEngines.packageManager.onFail(and/orruntime.onFail) to"warn"instead of"error"so that npm then only warns.Caveat: you lose hard enforcement for actual project engines.
npm:<pkg>tool from a directory outside the project (nopackage.jsonwithdevEngines) then manually add the tool to the mise config within the project.Beta Was this translation helpful? Give feedback.
All reactions