close

[Solved] nodejs – error self signed certificate in certificate chain

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error nodejs – error self signed certificate in certificate chain in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How nodejs – error self signed certificate in certificate chain Error Occurs?

Today I get the following error nodejs – error self signed certificate in certificate chain in javascript.

How To Solve nodejs – error self signed certificate in certificate chain Error ?

  1. How To Solve nodejs – error self signed certificate in certificate chain Error ?

    To Solve nodejs – error self signed certificate in certificate chain Error You can write command npm config set strict-ssl=false

  2. nodejs – error self signed certificate in certificate chain Error ?

    To Solve nodejs – error self signed certificate in certificate chain Error You can write command npm config set strict-ssl=false

Solution 1


You can fix this issue using NODE_TLS_REJECT_UNAUTHORIZED=0 in the terminal or inserting the following line within the JS file.

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

Beware that this a hack and it should not be used in production.

If you are using windows then run the following command in the command prompt:

set NODE_TLS_REJECT_UNAUTHORIZED=0 

After that, npm install <my-package> will work.

Solution 2

You can write command npm config set strict-ssl=false

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment