命令行下载scoop:
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
报错:
MethodInvocationException: Exception calling “DownloadString” with “1” argument(s): “请求的名称有效,但是找不到请求的类型的数据。 (raw.githubusercontent.com:443)”
首先检查了一下代理,没有问题,因此不是代理的锅
然后ping了一下raw.githubusercontent.com,全部丢包,那么就是host解析的锅了
打开https://ipaddress.com/,搜索raw.githubusercontent.com
What IP addresses does raw.githubusercontent.com resolve to?
raw.githubusercontent.com resolves to 4 IPv4 addresses and 4 IPv6 addresses:
185.199.108.133
185.199.109.133
185.199.110.133
185.199.111.133
2606:50c0:8000::154
2606:50c0:8001::154
2606:50c0:8002::154
2606:50c0:8003::154
In what country are raw.githubusercontent.com servers located in?
raw.githubusercontent.com has servers located in the United States.
What webserver software does raw.githubusercontent.com use?
raw.githubusercontent.com is powered by "GitHub.com" webserver.
管理员身份打开文件C:\Windows\System32\drivers\etc\host
末端追加一行:
185.199.108.133 raw.githubusercontent.com
再测试一下ping通了
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
重新运行上面命令下载scoop,指令正常工作,scoop下载成功