Elm-json fails to fetch package versions

Hi,

Whenever I run npx elm-app test (or elm-review, etc.), it fails with the following message.

❯ npx elm-app test
Solving dependencies
Failed to run `elm-json solve`:
phase: retrieve
 Nov 22 14:41:03.849 WARN Failed to fetch versions from package.elm-lang.org

-- NO VALID PACKAGE VERSION ----------------------------------------------------

Because rl-king/elm-iso3166-country-codes does not appear to exist and this
project depends on rl-king/elm-iso3166-country-codes 2.0.0, no valid set of
package versions could be found.

So I understand that it calls elm-json and that is the one that actually fails. Let me run it with verbose output:

❯ npx elm-json -vv solve
phase: retrieve
 Nov 22 14:42:03.435 DEBG Fetching versions since 10090
 Nov 22 14:42:03.797 WARN Failed to fetch versions from package.elm-lang.org
phase: resolve
 Nov 22 14:42:03.801 INFO beginning dependency resolution
phase: retrieve
 Nov 22 14:42:03.802 DEBG Finding best version for package root with constraint 1.0.0
 Nov 22 14:42:03.803 DEBG Finding best version for package rl-king/elm-iso3166-country-codes with constraint 2.0.0
phase: resolve
 Nov 22 14:42:03.803 INFO Failed to add package rl-king/elm-iso3166-country-codes 2.0.0: Unknown package rl-king/elm-iso3166-country-codes
 Nov 22 14:42:03.803 INFO solve failed

-- NO VALID PACKAGE VERSION ----------------------------------------------------

Because rl-king/elm-iso3166-country-codes does not appear to exist and this
project depends on rl-king/elm-iso3166-country-codes 2.0.0, no valid set of
package versions could be found.

Then I check the referred URL https://package.elm-lang.org/all-packages/since/10090 and it does have an entry for "rl-king/elm-iso3166-country-codes@2.0.0".

I have tried various things (like upgrading npm, reinstalling the project etc.) but nothing seemed to help. My coworkers and the CI jobs have no problem with the same project.

This problem started to happen from one day another, nothing was changed in the project. We have this dependency for a long time. I might changed something on my computer, but I cannot recall anything relevant.

Do you have any ideas how to untackle this issue?

GitHub project and tag seems to exist too, so it does exist:

Have you tried deleting ~/.elm (or renaming to elm_old) and trying again? Maybe your cache corrupted somehow.

Thanks for the hint. Now it breaks with another package.

❯ rm -rf ~/.elm
❯ npx elm-json -vv solve
phase: retrieve
 Nov 22 15:30:48.789 DEBG Fetching versions since 0
 Nov 22 15:30:49.184 WARN Failed to fetch versions from package.elm-lang.org
phase: resolve
 Nov 22 15:30:49.185 INFO beginning dependency resolution
phase: retrieve
 Nov 22 15:30:49.185 DEBG Finding best version for package root with constraint 1.0.0
 Nov 22 15:30:49.185 DEBG Finding best version for package NoRedInk/elm-json-decode-pipeline with constraint 1.0.0
phase: resolve
 Nov 22 15:30:49.185 INFO Failed to add package NoRedInk/elm-json-decode-pipeline 1.0.0: Unknown package NoRedInk/elm-json-decode-pipeline
 Nov 22 15:30:49.185 INFO solve failed

-- NO VALID PACKAGE VERSION ----------------------------------------------------

Because NoRedInk/elm-json-decode-pipeline does not appear to exist and this
project depends on NoRedInk/elm-json-decode-pipeline 1.0.0, no valid set of
package versions could be found.

It seems if it couldn’t access the package repo. I wonder how I can debug that.

I found a clue. I used Wireshark to listen to the network traffic while running elm-json. I captured a Certificate Expired error. However, when I go to the website in any browser, it shows a valid certificate.


I tried to connect to https://package.elm-lang.org via the Python shell and that worked well. So somehow the OSX binary of elm-json has some issue, I guess.

1 Like

In the end, I reported the issue at elm-json’s GitHub space. According to jfmengels, it’s very likely an issue with older OSX versions.

The problem was an expired root cert in /etc/ssl/certs.pem (on OSX Mojave). By removing it from the file, I managed to get elm-json working again.

2 Likes