Many developers face a common issue while working with Angular projects — everything runs smoothly one day, and suddenly the next day the project refuses to start.
This usually happens due to a Node.js version mismatch.
Angular CLI and framework versions depend on specific Node versions, and if the system updates or the global Node version changes, the build commands can fail unexpectedly.
This guide explains how to manage and switch Node versions using NVM (Node Version Manager) on Windows to fix Angular version compatibility issues.
Why This Happens
Each Angular version officially supports certain Node.js versions.
For example:
| Angular Version | Compatible Node Version |
|---|---|
| Angular 20 | Node 20 |
| Angular 18 | Node 18 |
| Angular 17 | Node 18 |
If the wrong Node version is active, the following errors may appear:
"Your Node.js version is not supported""Cannot find module @angular/cli"-
npm installfails due to version conflicts
Step 1: Check Current Node Version
To check the current Node version, run:
node -v
Example output:
v18.20.8
If the project requires Node 20, switch versions using NVM.
Step 2: Check Installed Node Versions
List all installed Node versions:
nvm list
Example:
20.19.5
20.19.0
* 18.20.8 (Currently using 64-bit executable)
If Node 20 isn’t installed yet:
nvm install 20
Step 3: Switch to the Required Node Version
Activate Node 20:
nvm use 20
Confirm the active version:
node -v
Expected output:
v20.x.x
If the version does not change, it may indicate a global Node installation conflict.
Step 4: Fix PATH Conflicts on Windows
To identify which Node executable is being used, run:
where node
If the result includes both paths below, there’s a PATH conflict:
C:\Program Files\nodejs\node.exe
C:\Users\<username>\AppData\Roaming\nvm\v20.19.5\node.exe
To fix:
- Open Control Panel → System → Advanced system settings → Environment Variables
- Edit the **Path **variable under “System variables”
- Remove this entry (if it exists):
C:\Program Files\nodejs\
- Save and restart the terminal
- Run:
nvm use 20
node -v
Now Node 20 should be active.
Step 5: Install the Matching Angular CLI Version
To install Angular CLI compatible with Angular 20:
npm install -g @angular/cli@20
Inside the project folder:
npm install
Verify:
ng version
The CLI and framework should both show version 20.
Step 6: Run the Project
Start the Angular development server:
ng serve
OR
npm start
If the setup is correct, the project should compile and run without errors.
💡 Bonus Tip: Use .nvmrc for Per-Project Node Version Management
Create a .nvmrc file in the project’s root directory and add the Node version number:
20
Then simply run:
nvm use
This automatically switches to the correct Node version for that specific project.
🎯 Conclusion
Using NVM (Node Version Manager) simplifies working with multiple Angular projects that require different Node versions.
With this setup:
- Node and Angular versions remain compatible
- Version conflicts are easy to fix
- Projects stay consistent across development environments
No more unexpected “version mismatch” errors — just smooth Angular development 🚀
Top comments (0)