the "engines" field in package.json Explained
What the "engines" field in package.json does, with an example.
Published November 12, 2026
The engines field in package.json states which Node.js (and npm) versions a project supports. By default npm only warns on a mismatch; with engine-strict it refuses to install.
How it works
Use semver ranges such as >=20. It documents requirements for contributors and CI, and some hosts read it to choose the Node version.
Combine with .nvmrc for local tooling.
Try it
npm install
npm WARN EBADENGINE Unsupported engine { required: { node: '>=20' }, current: { node: 'v18.0.0' } }
Practical examples
Declare
{ "engines": { "node": ">=20", "npm": ">=10" } }Strict enforcement
engine-strict=true # in .npmrcPair with nvm
echo 20 > .nvmrc
nvm useCheck current
node -v
npm -vCommon mistakes
- Setting ranges so tight that installs break.
- Expecting a hard failure without engine-strict.
- Forgetting to update when upgrading Node.
Key takeaways
- The engines field in package.json states which Node.js (and npm) versions a project supports.
- Run npm help <command> for every option.
- Commit package-lock.json.
FAQ
Does it install Node for me?
No, it only declares and checks the requirement.
Does this work with yarn or pnpm?
They have equivalents with similar commands.