In my case this happened in my Github Actions build pipeline when I was running npm run build
.
I was able to fix it by providing the following environment argument:
export NODE_OPTIONS=--openssl-legacy-provider
According from what I have read this node option can also be set in package.json.
What I did was modifying the scripts section of my package.json:
"scripts": {
"ng": "set NODE_OPTIONS=--openssl-legacy-provider && ng",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Now I can run npm start
again without problems.
This seems a bit easier than downgrading nodejs to v16.