Haskell堆栈连接超时

时间:2019-09-16 18:49:58

标签: haskell windows-subsystem-for-linux haskell-stack

我已经在Windows 10上使用WSL2在WSL Ubuntu上安装了堆栈。安装成功完成,但是当我使用

测试堆栈时
stack path --local-bin

我收到以下错误消息:

Writing implicit global project config file to: 
/home/jdgallag/.stack  /global-project/stack.yaml 
Note: You can change snapshot via the resolver field there.      
HttpExceptionRequest Request {                                                                                            
host                 = "s3.amazonaws.com"                                                                               
port                 = 443                                                                                              
secure               = True                                                                                             
requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
path                 = "/haddock.stackage.org/snapshots.json"                                                           
queryString          = ""                                                                                               
method               = "GET"                                                                                            
proxy                = Nothing                                                                                          
rawBody              = False                                                                                            
redirectCount        = 10                                                                                               
responseTimeout      = ResponseTimeoutDefault       
requestVersion       = HTTP/1.1                                                                                       
}                                                                                                                        
ConnectionTimeout   

我看过其他一些有关此类问题的文章,但没有一个得到解决,而且它们已经过时了。另外,我不在代理服务器上,这是我的个人计算机,并且我完全关闭了防火墙。就是说,当我尝试通过VPN连接执行此操作时,出现了另一个错误。可能是ssl / https的问题,因为WSL2从技术上讲与Windows是一个不同的IP地址,因此该连接在Amazon端被阻止了吗?

尝试在VPN上尝试命令时记录一下,我得到的错误是

Writing implicit global project config file to: 
/home/jdgallag/.stack/global-project/stack.yaml                         
Note: You can change the snapshot via the resolver field there.                                                         
HttpExceptionRequest Request {                                                                                            
host                 = "s3.amazonaws.com"                                                                               
port                 = 443                                                                                              
secure               = True                  
requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]                               
path                 = "/haddock.stackage.org/snapshots.json"                                                           
queryString          = ""                                                                                               
method               = "GET"                                                                                            
proxy                = Nothing                                                                                          
rawBody              = False                                                                                            
redirectCount        = 10                                                                                               
responseTimeout      = ResponseTimeoutDefault                                                                           
requestVersion       = HTTP/1.1                                                                                       
}                                                                                                                        
(InternalException (HandshakeFailed Error_EOF)) 

更新

恢复为WSL-1可解决此问题,因此该问题是WSL-2特有的。我在另一台计算机上全新安装了Windows,从而复制了该问题,但尚未找到解决该问题的方法。

1 个答案:

答案 0 :(得分:0)

我的PC上安装了wls2 ubuntu 20.02
通过更改/etc/resolv.conf

的内容解决了此问题
cd /etc
sudo *your favorite editor* resolv.conf

将Google DNS服务器添加为

nameserver 8.8.8.8
nameserver 8.8.4.4

此固定堆栈不适用于我。