我在正确安装 NPM 时遇到问题。我已尝试逐步阅读此处有关堆栈溢出的几个帖子的说明,特别是来自此线程: SELF_SIGNED_CERT_IN_CHAIN error while using npm install
我还尝试过浏览 NPM 网站上的文档: https://blog.npmjs.org/post/78165272245/more-help-with-self-signed-cert-in-chain-and-npm.html
我每次尝试安装时仍然收到错误消息。请指教。
最佳答案
如果您使用公司代理(例如使用 Blue Coat ),您应该使用 http 而不是 https 作为存储库地址,例如
npm config set registry="http://registry.npmjs.org/"
见:Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm .
您还可以将失败的 self 证书导入您的系统并标记为受信任,或在安装软件包时临时禁用 SSL 验证(快速但不推荐的方法):
npm config set strict-ssl false
见:Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm .
推荐的方法(而且更痛苦)只是指向正确的证书文件,例如
npm config set cafile "<path to your certificate file>"
见:How to fix SSL certificate error when running Npm on Windows? .
关于node.js - NPM self_signed_cert_in_chain,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34498736/