Is there anyone here who uses Linux? Any ideas on why this might be failing on my machine? I’m running Manjaro Linux and it is a new install, about 6 weeks.
elm binary will use the DNS nameservers from /etc/resolv.conf to resolve domain names, and IIRC TCP queries are not supported. So maybe first check that this works fine:
You could open a shell inside your container, install dig and test that package.elm-lang.org resolution always works correctly in UDP:
docker run -it --rm alpine:3.11.2 /bin/ash
then inside the container:
apk update
apk add bind-tools
then
# Replace 192.168.100.1 by the nameserver defined in your /etc/resolv.conf
dig @192.168.100.1 +noall +answer +notcp +retry=0 package.elm-lang.org
You should get:
package.elm-lang.org. 14116 IN A 45.55.106.189
Run it several times to check that it is reliable (maybe in a loop).
Also to be sure it’s not linked to your local DNS resolution, try to add the following command in your Dockerfile before the elm make one:
@allanderek This issue is quite old without much activity, it seems to be sporadic, much folks in it had their issue solved, and information is very light.
I just cloned elm-spa-example in alpine 3.11.2 container then run elm make src/Main.elm without issues, so there is more to it than just a problem with http-client, something linked to the environment.
Thanks @dmy, I’ll try your suggestion when I get home this evening. I’ll post an update then. Thank you. This has been bugging for 3 weeks now, so frustrating! Your help is very much appreciated. I’ll be back in the evening.
On Host Machine / My Own Desktop (i.e. not docker)
I first deleted everything inside ~/.elm/0.19.1/packages/* and removed the elm-stuff folder from my project root.
[jwan@jwan-pc ~]$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.1.1
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14400 IN A 45.55.106.189
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14377 IN A 45.55.106.189
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14375 IN A 45.55.106.189
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14372 IN A 45.55.106.189
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14371 IN A 45.55.106.189
[jwan@jwan-pc ~]$ dig @192.168.1.1 +noall +answer +notcp +retry=0 package.elm-lang.org
package.elm-lang.org. 14371 IN A 45.55.106.189
[jwan@jwan-pc ~]$
I then ran elm make src/app/Main.elm --output=/dev/null and here is what I got:
[jwan@jwan-pc bejebeje.elm]$ elm make src/app/Main.elm --output=/dev/null
Starting downloads...
● elm/bytes 1.0.8
● elm/file 1.0.5
● elm/core 1.0.4
✗ elm/json 1.1.3
✗ elm/browser 1.0.2
✗ elm/http 2.0.0
✗ elm/time 1.0.0
✗ elm/virtual-dom 1.0.2
✗ elm/url 1.0.0
● elm/html 1.0.0
Dependency problem!
-- PROBLEM DOWNLOADING PACKAGE -------------------------------------------------
I need to find the latest download link for elm/browser 1.0.2, so I tried to
fetch:
https://package.elm-lang.org/packages/elm/browser/1.0.2/endpoint.json
But my HTTP library is giving me the following error message:
ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName
= <assumed to be undefined>}, host name: Just "package.elm-lang.org", service name: Just "443"): does not exist (Try again)
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!
[jwan@jwan-pc bejebeje.elm]$
As you can see, it failed even on the host machine. Perhaps I should try to fix this before trying to get it working within docker?
Note: If I run a couple of more times, then eventually all download and it works:
This is expected, because the Docker container uses the host DNS resolution.
So you can do the tests I proposed earlier, on the host or in the container, this should give the same results.
It seems your system DNS resolution (at least using UDP) has some reliability issues, you should check carefully your /etc/resvolv.conf,systemd-resolved configuration, and the DNS servers you use.
Do you use your ISP DNS servers?
Maybe try other ones like google or openDNS ones to check if it solves the issue.
So this wasn’t an Elm issue, but here’s what worked for me in case you’re in the same boat.
On my machine running Manjaro linux, I went and changed my DNS server to be 8.8.8.8 (that’s Google’s DNS server) and now elm make works on my machine and inside a docker container.