TLDR; If you are getting some random error from the Elm compiler like the one below, make sure that you are not running two compilations processes at the same time on the same machine for two different projects, as this could be an issue.
Let me move from the Slack chat to here the thread related to an issue (and a resolution), so that it became searchable in case other people face something similar in the future.
At work, we had issues with this type of error during a pipeline of a monorepo hosting several Elm projects:
-- PROBLEM BUILDING DEPENDENCIES ----------------------------- I ran into a compilation error when trying to build the following package: fredcy/elm-parseint 2.0.1 This probably means it has package constraints that are too wide. It may be possible to tweak your elm.json to avoid the root problem as a stopgap. Head over to https://elm-lang.org/community to get help figuring out how to take this path! Note: To help with the root problem, please report this to the package author along with the following information: elm/core 1.0.5 If you want to help out even more, try building the package locally. That should give you much more specific information about why this package is failing to build, which will in turn make it easier for the package author to fix it!
The weird thing is that these errors were happening on a random base and they were referencing random packages.
It seems the issue was about a conflict between the Elm caching system and the Nx/Jenkins caching system.
The Elm compiler caching system works on two separate layers.
One is located in the folder “elm-stuff” inside the project folder. The other is located in the folder “.elm” under the
$HOME folder (or
$ELM_HOME if defined).
While each Elm project has its own
.elm is shared among all the Elm projects on the same machine.
This caused issues when multiple instances of the compiler were running at the same time on the same machine, in parallel.
A resolution was to create an independent
.elm folder for each project with
This has the consequence that the same package is downloaded more than once if used in multiple projects, but this only happens the first time a project is created. After that, the Nx cache should kick in, and only newly added packages should be downloaded.
Any better suggestion is welcome.
I heard that similar issues are happening randomly on Netlify. Not sure what that could be, but it may still be related to some caching conflict. I don’t know if this issue could happen also if several compiler processes are happening at the same time but they belong to the same project, instead of different projects (the monorepo case).
Prior art and references