ERROR: SELF_SIGNED_CERT_IN_CHAIN using localhost

I got an error when using nodemailer on localhost, causing an internal server error (500): ERROR: SELF_SIGNED_CERT_IN_CHAIN

I found this thread on the issue: Npm SELF_SIGNED_CERT_IN_CHAIN on Azure, suggesting to do:

npm config set ca ""

but didn't help. also upgrading the npm didn't help:

npm update -g

so just when I was about the downgrade my node.js (version 10.32) I found this thread:

SELF_SIGNED_CERT_IN_CHAIN while launching server

suggesting it's the anti-virus that is blocking some needed certificates.

after disabling the anti-virus, it worked!

Disable antivirus "Outbound email scan" SMTP

wanted a way to leave my anti-virus running, and so just disabled the SMTP scan on Avast and all works. Am sure there is a better way, but this works.