When a package is outdated elm.json, what is the correct way to upgrade it?
At the moment I will just change the version there. But when doint elm make, the compiler complains with:
The dependencies in your elm.json are not compatible.
Did you change them by hand? Try to change it back! It is much better to add
dependencies with elm install or the dependency management tool in elm reactor.
(Removing elm-stuff didn’t help, when changing the version manually)
So instead I tried:
elm install author/package
Elm responds with It is already installed! without upgrading the version.
Doing:
elm install author/package@x.y.z
Doesn’t work.
Changing the version manually works fine if there are no dependecy conflicts. So this is to be only a problem when deps don’t match.
I had to manually find the conflicting packages in indirect in elm.json an change the version.
That doesn’t work. I just tried that to upgrade from elm/http 1.0.0 to 2.0.0, but elm install elm/http is still installing 1.0.0 after I removed elm/http from elm.json.
Elm/JSON was bumped on the same day, and Elm/HTTP relies on Elm/JSON. Bump both and it should start working. (Elm/core was bumped 5 days ago too, and I think Elm/HTTP requires the new one, so depending on your project’s age you might want to change Elm/core’s version as well.)
ok, I had to remove all three to get elm/http 2.0.0.
I find it strange that there is no warning when I run elm install elm/http about installer being unable to install newest version because of dependency conflicts.
elm install does not install the latest version, it installs the latest version compatible with your other dependencies. If you have other dependencies requiring elm/http "1.0.0 <= v < 2.0.0", elm install won’t be able to install elm/http 2.0.0. If no version is compatible, it will complain.
As far as I know, the behavior is similar to other semver installers, like npm (there is no warning either when it cannot install the latest version).
Has anyone built a tool that will find conflicting versions?
I’m trying to upgrade http to 2.0, and would like to avoid having to inspect all the ‘elm.json’ for all the packages we use (and the deps of those packages).
The way I did it was to rm elm.json && elm init, then repeat this process:
elm make
#fix compilation errors from http 2.0.0 if you've arrived at that point
elm install <the thing make fails on>
This way, when I came to elm install elm/http, there was nothing in elm.json that would prevent it from choosing the newest version.
This process does imply that you’re updating all your dependencies to the latest version, not just one particular dependency. But one could imagine a slightly more complex variation on it that would focus on a single upgrade, something like:
elm make
#if you're at or beyond the point of errors about http then:
#fix compilation errors from http 2.0.0 if you've arrived at that point
elm install <the thing make fails on>
#else
#manually restore the line in elm.json that make failed on