解决angular安装 unable to access 'https:github...' Empty reply from server

解决方案:指定https方式,使用代理

错误提示:

    $ npm install
    ......
    bower angular-mocks#1.5.x             ECMDERR Failed to execute "git ls-remote --tags --heads
    https://github.com/angular/bower-angular-mocks.git", exit code of #128 fatal: unable to access
    'https://github.com/angular/bower-angular-mocks.git/': Empty reply from server
    
    Additional error details:
    fatal: unable to access 'https://github.com/angular/bower-angular-mocks.git/': Empty reply from server
复制代码

分析:这段脚本执行区git拉取代码所用到(默认用ssh)的端口被禁止使用.应该改用https的方式进行下载.

最后在堆栈溢出找到这个方案

    git config --global url."https://".insteadOf git://
复制代码

再次执行 这个问题没再出现

    $ npm install
复制代码

ps: 这个https方式有几率会报错

分析:这里是被墙了
错误提示
    $ npm install
    ......
    ECMDERR Failed to execute "git ls-remote --tags --heads
    https://github.com/angular/bower-angular-animate.git", exit code of #128 fatal: unable to access
    'https://github.com/angular/bower-angular-animate.git/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
复制代码

分析原因还是因为https的方式,撞在了墙上.git默认是不走系统代理的,所以我们需要指定代理来使用https拉取github代码.

解决方案:配置代理

代理配置方法如下(当然啦,最后那个 url 改成自己的代理地址和端口):

    git config --global http.proxy http://127.0.0.1:1080
    git config --global https.proxy https://127.0.0.1:1080
复制代码
撤销代理:
    git config --global --unset http.proxy
    git config --global --unset https.proxy
复制代码
如果要查当前的代理配置,分别是:
    git config --global --get http.proxy
    git config --global --get https.proxy
复制代码

最后成功运行

    $ npm install
    ......
    angular-resource#1.5.11 app\bower_components\angular-resource
    └── angular#1.5.11
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted
    {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    up to date in 106.584s
复制代码
参考

为 git 设置 http https 代理

  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值