首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Elm安装总是因"ConnectionTimeout“错误而失败(在WSL中)

Elm安装总是因"ConnectionTimeout“错误而失败(在WSL中)
EN

Stack Overflow用户
提问于 2020-12-19 06:18:46
回答 2查看 494关注 0票数 2

我是埃尔姆的新手。我也不擅长英语。因此,如果有任何不明确或错误的东西,请让我纠正它。

-编辑

我下面所有的问题都是关于WSL的。我试窗户的时候,一切都很好。然后..。为什么elm install不能在WSL上工作?你知道吗?

-问题

当我尝试elm-test init时,它不像下面这样工作

代码语言:javascript
复制
$ elm-test init
Here is my plan:
  
  Add:
    elm/random               1.0.0
    elm-explorations/test    1.2.2

Would you like me to update your elm.json accordingly? [Y/n]: 
-- PROBLEM DOWNLOADING PACKAGE -------------------------------------------------

I was trying to download the source code for elm/random 1.0.0, so I tried to
fetch:

    https://github.com/elm/random/zipball/1.0.0/

But my HTTP library is giving me the following error message:

    ConnectionTimeout

Are you somewhere with a slow internet connection? Or no internet? Does the link
I am trying to fetch work in your browser? Maybe the site is down? Does your
internet connection have a firewall that blocks certain domains? It is usually
something like that!

但是我的浏览器(Chrome)工作得很好,甚至在WSL (我运行elm-test init命令的环境)中也是如此。

代码语言:javascript
复制
$ curl https://github.com/elm/random/zipball/1.0.0/
https://codeload.github.com/elm/random/legacy.zip/1.0.0<body>You are being <a href="https://codeload.github.com/elm/random/legacy.zip/1.0.0">redirected</a>.</body></html>

然后,我再次尝试重定向URL

代码语言:javascript
复制
$ curl https://codeload.github.com/elm/random/legacy.zip
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

我觉得没有网络问题。我的个人电脑可以连接回购,我认为它会很好地下载。

最后,我尝试了elm install,这也引发了同样的错误。似乎埃尔姆无法连接回购,即使我的个人电脑可以。

代码语言:javascript
复制
$ elm install elm/random
Here is my plan:
  
  Add:
    elm/random    1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: 

-- PROBLEM DOWNLOADING PACKAGE -------------------------------------------------

I was trying to download the source code for elm/random 1.0.0, so I tried to
fetch:

    https://github.com/elm/random/zipball/1.0.0/

But my HTTP library is giving me the following error message:

    ConnectionTimeout

Are you somewhere with a slow internet connection? Or no internet? Does the link
I am trying to fetch work in your browser? Maybe the site is down? Does your
internet connection have a firewall that blocks certain domains? It is usually
something like that!

请帮帮我,我该怎么办?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-20 09:02:02

我最近有理由使用WSL进行榆树开发。这不是什么有趣的,我很高兴回到Mac!我发现,WSL上的某些磁盘操作似乎进展非常缓慢,这可能导致各种奇怪的问题。

我使用的是Webstorm,它不能很好地处理WSL,所以最后我在C:驱动器(而不是/home/...)上做了所有的事情,这样网络风暴就可以运行elm格式的windows版本,而我的节点开发环境则运行在linux层上。

这不是对你问题的准确回答,只是说它是可以做到的,但在我的经验中,这并不是写Elm代码的理想方法。

票数 2
EN

Stack Overflow用户

发布于 2022-10-28 20:28:28

我也有同样的问题被解决了。

这是由于DNS服务器的设置。

  1. 创建一个文件/etc/resolv.conf并编写下一行.

代码语言:javascript
复制
nameserver 8.8.8.8

然后,WSL将参考谷歌公共DNS和工作良好。

但是,当重新启动WSL时,设置会恢复。

因此,还需要下列设置。

  1. 创建一个文件/etc/wsl.conf并编写下一行.

代码语言:javascript
复制
[network]
generateResolvConf = false

  1. wsl --shutdown并重新启动WSL.

参考链接

https://github.com/microsoft/WSL/issues/4285#issuecomment-522201021

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65367218

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档