目录

  • 问题描述
  • 解决方案
  • 大概更好的解决方案

问题描述

将vcpkg项目下载到本地以后运行bootstrap-vcpkg.bat以后显示下载失败

PS D:\ProgramData\vcpkg> .\bootstrap-vcpkg.bat
Downloading https://github/microsoft/vcpkg-tool/releases/download/2022-07-21/vcpkg.exe -> D:\ProgramData\vcpkg\vcpkg.exe...While calling Windows API function WinHttpSendRequest got error 0x00002EFE:
与服务器的连接意外终止


D:\ProgramData\vcpkg\scripts\bootstrap.ps1 : Downloading vcpkg.exe failed. Please check your internet connection, or co
nsider downloading a recent vcpkg.exe from https://github/microsoft/vcpkg-tool with a browser.
所在位置 行:1 字符: 4
+ & {& 'D:\ProgramData\vcpkg\scripts\bootstrap.ps1' }
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,bootstrap.ps1

ScriptHalted
所在位置 D:\ProgramData\vcpkg\scripts\bootstrap.ps1:60 字符: 5
+     throw
+     ~~~~~
    + CategoryInfo          : OperationStopped: (:) [], RuntimeException
    + FullyQualifiedErrorId : ScriptHalted

解决方案

首先这个应该是因为某个众所周知的原因访问github困难造成的,可以使用代理下载。关键就是这个怎么设置代理。
首先当你在环境变量中设置https_proxy以后运行bootstrap-vcpkg.bat,下载的时候就会使用你的代理地址。

然后就是你的代理地址不能设置成https开头,而是应该设置成http开头,否则也无法下载成功。

大概更好的解决方案

运行bootstrap-vcpkg.bat命令貌似只是为了从github release页面上下载vcpkg.exe,所以可能直接去github release页面下载对应的vcpkg.exe文件放到vcpkg的根目录下就好了😂

更多推荐

vcpkg: bootstrap-vcpkg.bat下载失败问题