node.js NPM self_signed_cert_in_chain

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34498736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:42:06  来源:igfitidea点击:

NPM self_signed_cert_in_chain

node.jsnpmvisual-studio-2015

提问by jacobjp52285

I am having issues getting NPM to install properly. I have tried stepping through the instructions on several of the posts here on stack overflow, specifically from this thread: SELF_SIGNED_CERT_IN_CHAIN error while using npm install

我在正确安装 NPM 时遇到问题。我已经尝试通过这里关于堆栈溢出的几个帖子的说明,特别是从这个线程: SELF_SIGNED_CERT_IN_CHAIN error while using npm install

Also I have tried going through the documentation on NPM's site: http://blog.npmjs.org/post/78165272245/more-help-with-selfsignedcertinchain-and-npm

我也试过浏览 NPM 网站上的文档:http: //blog.npmjs.org/post/78165272245/more-help-with-selfsignedcertinchain-and-npm

I am still receiving the error everytime I try to install. please advise.

每次尝试安装时,我仍然收到错误消息。请指教。

回答by kenorb

If you're behind the corporate proxy (which uses e.g. Blue Coat), you should use http instead of https for repository addresses, e.g.

如果您支持公司代理(例如使用Blue Coat),您应该使用 http 而不是 https 作为存储库地址,例如

npm config set registry="http://registry.npmjs.org/"

See: Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm.

请参阅:错误:SSL 错误:SELF_SIGNED_CERT_IN_CHAIN 使用 npm 时



You can also import failing self-certificate into your system and mark as trusted, or temporary disable SSL validation while installing packages (quick, but not recommended method):

您还可以将失败的自我证书导入系统并标记为受信任,或在安装软件包时暂时禁用 SSL 验证(快速但不推荐的方法):

npm config set strict-ssl false

See: Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm.

请参阅:错误:SSL 错误:SELF_SIGNED_CERT_IN_CHAIN 使用 npm 时



The recommended way (and more painful) is just to point to the right certificate file, e.g.

推荐的方法(也更痛苦)只是指向正确的证书文件,例如

npm config set cafile "<path to your certificate file>"

See: How to fix SSL certificate error when running Npm on Windows?.

请参阅:如何在 Windows 上运行 Npm 时修复 SSL 证书错误?.

回答by Higor Felype

Use this command below and it could work fine:

使用下面的这个命令,它可以正常工作:

npm config set registry="http://registry.npmjs.org/"

npm config set registry="http://registry.npmjs.org/"