I'm diving into Angular as a beginner and currently working on a project specifically with Angular 12. To set things up, I opted not to install Angular CLI globally and instead used npx -p @angular/cli@12 new hello-world-project. Following Angular's documentation, I noted that the required Node.js version should be ^12.14.0 || ^14.15.0. So, with the help of nvm, I switched to the specified Node version mentioned in the documentation.

However, upon trying to run the application with ng serve, I encountered an issue stating that The Angular CLI requires a minimum Node.js version of v18.13.. It's quite puzzling because even when I adjust the Node version to the minimum required, say 18.13, the Angular CLI functions, but my application fails to run, throwing a compatibility error related to Node:

Compiling @angular/platform-browser-dynamic : es2015 as esm2015 Generating browser application bundles (phase: building)...node:internal/crypto/hash:69 this[kHandle] = new _Hash(algorithm, xofLen); ^

Error: error:0308010C:digital envelope routines::unsupported

enter image description here

Do any of you have an idea if I've missed something? Just to note, I'm working on Windows.

I've already attempted to switch my Node version to 12.14 and 14.5, as well as some versions below those, but to no avail. Interestingly, whenever I opt for a version higher than 18.13, my application throws an error indicating incompatibility with Node.

2

There are 2 best solutions below

2
Alpine A110R On

You are using Angular 12.2.x and you must following supported NODE.JS version

**Version compatibility: NG 12.2.x **

^12.14.0 || ^14.15.0

If you are using nvm, make sure that the required version is correctly installed on local.

Exemple

nvm install 12.14.0

node -v

If you want to see what versions are installed :

nvm ls

So remove your node_modules, clean your cache with npm cache clean —-force, and retry to install dependencies with npm install.

0
Larissa Rodrigues On

I managed to resolve my issue! I reinstalled the Angular CLI globally to version 12, ensured Node was on version 12.14.1, and reinstalled the project. Now it's running smoothly with ng serve.