templates that have a failing engines key in package.json, and version is pre-release, cannot be installed (using `latest` dist-tag)
- Dominant language
- JavaScript
- Stars
- 95
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Template: https://github.com/adobe/commerce-events-ext-tpl
## Repro Steps
1. Use `node@20.17.0` or greater and `npm@10.8.2` or greater
2. Install the template above using the aio-cli (via `aio app init`) or `npm i`
Error:
```
npm error code ETARGET
npm error notarget No matching version found for @adobe/commerce-events-ext-tpl@*.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
```
## Expected Behavior
The template/module can be installed.
## Actual Behavior
The template/module cannot be installed and results in an error.
## Investigation
`npm@10.8.2` or greater has different behavior due to a bug fix. Users may have been relying on buggy behavior which has been fixed now.
The template above has an engines key of `^14` and is a pre-release version `1.0.0-beta.9` which results in the error.
Installing the module using a specific version, will not result in the error, there is an error only if it's using the `latest` dist-tag.
If I tested `npm i` of a module that fails the engine check on `node-22` and is `not a pre-release`, it does **not** result in an error. [Example module](https://www.npmjs.com/package/memlab?activeTab=readme).
## Fix
Remove the "engines" key from the template's package.json or update the engines key to a version that will pass on nodes >= 20, and/or update the version to a non-pre-release version.
## Supporting Info
1. https://docs.npmjs.com/cli/v10/using-npm/changelog#1082-2024-07-09
2. https://github.com/npm/npm-pick-manifest/releases/tag/v9.1.0
3. https://github.com/npm/npm-pick-manifest/commit/9f5560ff8a21a83323fa188b44db8545ac8bd55d
4. https://github.com/nodejs/nodejs.org/issues/6913
5. node version to npm version mappings: https://nodejs.org/dist/index.json
Contributor guide
Assessment
This issue has not been assessed yet.