Your project builds cleanly locally, yet fails out of nowhere for a teammate or in CI — nine times out of ten, an outdated Node.js version is to blame. Three short files in the repository root close that gap without custom scripts.
First, add .nvmrc with the exact version and enable strict checking in .npmrc:
# Exact version for nvm use and fnm use
echo "26.13.1" > .nvmrc
# Block installs on the wrong version
echo "engine-strict=true" > .npmrc
.nvmrc is read by nvm and the fast Rust-based fnm (which can switch automatically on cd via fnm env --use-on-cd). Since people forget to run nvm use, add a second layer in engines inside package.json:
{
"engines": {
"node": ">=26"
}
}
By default, npm only prints npm WARN EBADENGINE and keeps going. Setting engine-strict in .npmrc turns that warning into a hard EBADENGINE error and aborts npm install (the old engineStrict field in package.json no longer works).
pnpm respects the same .npmrc setting (ERR_PNPM_BAD_NODE_VERSION), while Yarn v2+ uses its own config. In CI like GitHub Actions (actions/setup-node), pass node-version-file: '.nvmrc' so you don't duplicate the version number.

