I ran into a vague build problem recently, and I’m posting it because I didn’t find other cases of it when googling.
When building with netlify, but not locally, I would get this error from the elm compiler:
3:41:29 PM: > elm-pages build
3:41:33 PM: -- PROBLEM BUILDING DEPENDENCIES -----------------------------------------------
3:41:33 PM: I ran into a compilation error when trying to build the following package:
3:41:33 PM: ianmackenzie/elm-units 2.9.0
3:41:33 PM: This probably means it has package constraints that are too wide. It may be
3:41:33 PM: possible to tweak your elm.json to avoid the root problem as a stopgap. Head
3:41:33 PM: over to https://elm-lang.org/community to get help figuring out how to take this
3:41:33 PM: path!
3:41:33 PM: Note: To help with the root problem, please report this to the package author
3:41:33 PM: along with the following information:
3:41:33 PM: elm/core 1.0.5
3:41:33 PM: elm/time 1.0.0
I’m still unsure exactly what fixed my build, but it was some combination of these two things:
-
Clearing the cache before deploying my site. There’s a button on netlify for this, and I believe it removed the influence of an old ELM_HOME directory and elm-stuff folder. (Thanks @dillonkearns for the pointer here and for shepherding across the relevant slack channels!) This did not work on its own however.
-
Following advice here to analyze my elm.json with this tool I found that I had a dependency on “stil4m/structured-writer 1.0.1”. The tool was having trouble loading it, and according to elm packages, that version is not compatible with elm 0.19.1! After updating this dependency with
elm-json install stil4m/structured-writer
my build succeeded.