首页 > 解决方案 > npm 安装错误 ssh

问题描述

我从https://github.com/maputnik/editor/releases/tag/v1.2.0下载了 maputnik 版本,并尝试在带有 ssh 锁的公司代理后面的 Windows 7 上使用 npm 安装。

我收到以下错误:

    $ npm 安装
    npm 错误!执行时出错:
    npm 错误!C:\Program Files\Git\mingw64\bin\git.EXE ls-remote -h -t ssh://git@github.com/josdejong/jsonlint.git
    npm 错误!
    npm 错误!ssh:连接到主机 github.com 端口 22:连接超时
    npm 错误!致命:无法从远程存储库中读取。

在阅读了几篇关于 npm install behind proxy 的帖子后,我更改了我的 npm 和 git 配置:

npm(.npmrc 文件):

    严格-ssl=false
    代理=http://user:password@proxy.company.com:8080
    https-proxy=http://user:password@proxy.company.com:8080
    注册表=http://registry.npmjs.org/

混帐(.gitconfig 文件):

    [http]
        代理 = http://user:password@proxy.company.com:8080
        sslverify = 假
    [https]
        代理 = http://user:password@proxy.company.com:8080
        sslverify = 假
    [网址“https://github.com/”]
        相反= ssh://git@github.com/
    [网址“https://”]
        代替 = git://

现在至少git ls-remote -h -t ssh://git@github.com/josdejong/jsonlint.git
git clone ssh://git@github.com/josdejong/jsonlint.git工作。但我仍然得到同样的错误npm install

似乎该配置适用于 git 但不适用于 npm。还有其他地方我必须配置代理或 url 替换吗?

标签: gitnpmsshproxy

解决方案


推荐阅读