Node,Error: self signed certificate

方式 0 收信任的 SSL ,是没有这个问题的

参考open in new window

方式 1 屏蔽

If that's the case, add as an environment variable wherever you are running node

export NODE_TLS_REJECT_UNAUTHORIZED='0'
node app.js
1
2

or running node directly with

NODE_TLS_REJECT_UNAUTHORIZED='0' node app.js
1

This instructs Node to allow untrusted certificates (untrusted = not verified by a certificate authority)

If you don't want to set an environment variable or need to do this for multiple applications npm has a strict-ssl config you set to false

npm config set strict-ssl=false
1

方式 2 添加证书

Load in CA cert