Search code examples
windows-subsystem-for-linuxelmconnection-timeout

Elm install always fails with "ConnectionTimeout" error (in WSL)


I'm new to Elm. and I'm not good at English. So, if any ambiguous or wrong thing is there, please let me correct it.

----------- edit -----------
All my problem below is on WSL. when I'm trying on windows, all work fine. then... why elm install doesn't work on WSL? did you have any idea?

-------- problem --------
when I try to elm-test init, it doesn't work like below

$ 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!

but my Browser(Chrome) is working beautifully, and even in WSL (the environment that I run elm-test init command at) is too.

$ 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>

then I also try again to redirect the URL

$ 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.

I think there's no Network Problem. My PC can connect with the repo, and I think it will be downloaded well.

I lastly tried just elm install, and that throws the same error too. it seems like Elm can't connect with the repo, even if My PC can.

$ 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!

Please help me, what should I do?


Solution

  • I recently had reason to use WSL for elm development. It wasn't much fun and I'm glad to be back on Mac! What I found was that certain disk operations on WSL seemed to go very slowly and that could lead a variety of weird issues.

    I was using Webstorm, which does not handle WSL well, so in the end I did everything on C: drive (rather than in /home/...) so that webstorm could run the windows version of elm-format, while my node development environment was run on the linux layer.

    That's not a precise answer to your question but just to say that it can be done, but its not an ideal way to write Elm code in my experience