勺子安装时间超时


0

我想在笔记本电脑上安装scoop,我没有管理员权限。我在PowerShell中使用以下命令:

PS> Set-ExecutionPolicy RemoteSigned -scope CurrentUser
PS> iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Exception calling "DownloadString" with "1" argument(s): "The operation has timed out"
At line:1 char:1
+ iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

我相信这是因为它默认使用IPv6而不是IPv4:

PS> ping get.scoop.sh
Pinging d19x8hxthvia8.cloudfront.net [2600:9000:2002:7200:1f:b80:d400:93a1] with 32 bytes of data:
General failure.
General failure.
PS> ping -4 get.scoop.sh
Pinging d19x8hxthvia8.cloudfront.net [52.85.245.136] with 32 bytes of data:
Reply from 52.85.245.136: bytes=32 time=27ms TTL=246
Reply from 52.85.245.136: bytes=32 time=25ms TTL=246

如何强制iex命令使用IPv4而不是IPv6?


请注意,一般情况下,如果操作系统看到IPv6 可以开始使用,则它只会选择IPv6 。您的路由器可能具有部分配置,例如,广告地址前缀但不是默认路由。
grawity

通常IPv6应该正常工作。我现在注意到我无法ping谷歌,因为它默认为IPv6。我将调查这是由于笔记本电脑配置错误还是路由器配置错误造成的。
Tommiie

Answers:


0

我找到了以下工作解决方案:

PS> Set-ExecutionPolicy RemoteSigned -scope CurrentUser
PS> $wc = new-object net.webclient
PS> $wc.headers.add('host', 'get.scoop.sh')
PS> iex $wc.downloadstring('https://52.85.245.136')
Initializing...
Downloading...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.