1.0 KiB
1.0 KiB
ADR 0010: Node Version Management with nvm and .nvmrc
Date: 2026-04-26 Status: Accepted
Context
Angular 21 requires Node.js >= 20.19 or >= 22.12. The system Node version on a development machine may not meet this requirement, causing silent build failures or CLI errors.
Decision
A .nvmrc file at the repository root pins the Node version to 20.19.6. Developers use nvm use to switch to this version. The Husky pre-commit hook explicitly calls nvm use 20.19.6 before running tests to ensure the correct version is active in the hook's shell environment.
Consequences
- Positive: Consistent Node version across all commands (dev server, build, tests, pre-commit hook).
- Positive:
.nvmrcdocuments the required Node version explicitly in the repository. - Constraint: Requires nvm. Developers using other version managers (fnm, volta) must align manually.
- Note: The
package.jsonenginesfield also declares the required Node range (^20.19.0 || ^22.12.0) as a secondary signal.