Today I received the following error in my node js express server: unable to get local issuer certificate.
After some research I found out, that the expression process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; allows any unauthorized certificates. This works, but I would like to add a certificate to my service.
So I found this ticket/ answer (https://stackoverflow.com/a/44726189/17330227) which explains how to add a certificate. I have done the steps one by one and am now stuck on the last one. You have to insert the certificate under cafile. For this I used the command npm config set cafile "C:\Users\...\Certificate.cer". Unfortunately I got the initial error message again and looked at the changes with npm config ls -l. At the entry cafile it says the following ; cafile = null ; overridden by user. Furthermore I get the following output cafile = "C:\Users\...Certificate.cer and ...\Certificate.cer = "".
Apparently I am doing something wrong in the "Add Certificate" step. I have tried different notations of the path, nothing works. If someone can help me, that would be great - thanks!