Error: error:0308010C:digital envelope routines::unsupported [ANGULAR]

I was trying to build my project on jenkins. The local build is successful but Jenkins build is failing. Any fix for this? I am using primeng module to implement p-organisationchart. I suspect that could be the issue.

versions I am using are:

`"primeicons": "^4.1.0", "primeng": "^11.3.0", "node" : 14.16.0` 

I am working on Angular 8

2

3 Answers

This is a webpack issue. As a workaround you can add an environment variable to your build task:

export NODE_OPTIONS=--openssl-legacy-provider 

See this issue in the webpack project.

You can add the environment variable to your package.json scripts part

{ "scripts": { "build": "export NODE_OPTIONS=--openssl-legacy-provider; ng build" } } 

If you are using docker you can add the environment variable to your Docker file before the build

ENV NODE_OPTIONS=--openssl-legacy-provider 

I am not familiar with jenkins. If you use bash-like scripts there to build your application you can also add the line to that script.

0

I was having this very same error, and it was solved by downgrading from Node 17.2 to 16.10

You may also run this in the console before launching ng serve

$ export NODE_OPTIONS=--openssl-legacy-provider 
1

I got the same error when this was written. My previous node version was the latest (18). What I do to solve this:

  1. go to nodejs website: nodejs.org
  2. search for version of nodejs which has npm version 6.14.8 -> I got nodejs v.14.15.0 -> download
  3. extract your download of nodejs: tar -xf (the-nodejs-file)
  4. edit .bashrc file $ vim ~/.bashrc and save it by :wq
  5. add this line: export PATH="/home/(your-name)/Downloads/node-v14.15.0-linux-x64/bin:$PATH"
  6. restart your terminal
  7. go to your project directory cd (your directory)
  8. run project ng serve

ng serve works!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like