npm 安装错误 - 无法获取本地颁发者证书 [英] npm install error - unable to get local issuer certificate

查看:73
本文介绍了npm 安装错误 - 无法获取本地颁发者证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行 npm 安装时遇到 unable to get local issuer certificate 错误:

I am getting an unable to get local issuer certificate error when performing an npm install:

typings ERR! message Unable to read typings for "es6-shim". You should check the
 entry paths in "es6-shim.d.ts" are up to date
typings ERR! caused by Unable to connect to "https://raw.githubusercontent.com/D
efinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6-shim
/es6-shim.d.ts"
typings ERR! caused by unable to get local issuer certificate

我最近从一个更早的版本更新到节点 4,当出现此类问题时,节点听起来要严格得多.

I have recently update to node 4 from a much earlier version and it sounds like node is much more strict when these kind of problems arise.

here 讨论了一个关于使用 ca 的问题文件,但这有点超出我的理解,我不确定该怎么做.

There is an issue discussed here which talks about using ca files, but it's a bit beyond my understanding and I'm unsure what to do about it.

我在公司防火墙后面,但我可以在浏览器中正常访问 url,没有任何限制.

I am behind a corporate firewall, but I can get to the url fine in a browser without any restriction.

有没有人对这个问题有任何进一步的了解以及有哪些可能的解决方案?

Does anyone have any further insight into this issue and what possible solutions there are?

我想在此期间恢复到节点 0.12 :(

I'm wondering about reverting to node 0.12 in the meantime :(

推荐答案

可以使用 ~/.typingsrc 配置文件配置类型.(~ 表示你的主目录)

Typings can be configured with the ~/.typingsrc config file. (~ means your home directory)

在github上发现这个问题后:https://github.com/typings/typings/issues/120,我可以通过创建 ~/.typingsrc 并设置此配置来解决这个问题:

After finding this issue on github: https://github.com/typings/typings/issues/120, I was able to hack around this issue by creating ~/.typingsrc and setting this configuration:

{
  "proxy": "http://<server>:<port>",
  "rejectUnauthorized": false
}

它似乎在没有 proxy 设置的情况下也能工作,所以也许它能够从某个地方的环境中提取出来.

It also seemed to work without the proxy setting, so maybe it was able to pick that up from the environment somewhere.

这不是一个真正的解决方案,但足以让 typings 忽略公司防火墙问题,以便我可以继续工作.我相信那里有更好的解决方案.

This is not a true solution, but was enough for typings to ignore the corporate firewall issues so that I could continue working. I'm sure there is a better solution out there.

这篇关于npm 安装错误 - 无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆