# How do your upgrade a package in your app

**URL:** <https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505>\
**Category:** Request Feedback\
**Created:** [November 12, 2018, 1:36am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505 "2018-11-12T01:36:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/sebastian/32/98_2.png) [@Sebastian](https://discourse.elm-lang.org/u/Sebastian)\
**Post date:** [November 12, 2018, 1:36am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/1 "2018-11-12T01:36:56Z")

</div>

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:

```auto
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:

```auto
elm install author/package

```

Elm responds with `It is already installed!` without upgrading the version.

Doing:

```auto
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.

Is there a better workflow for this?

---

<div class="post-metadata">

**Author:** ![dmy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dmy/32/702_2.png) [@dmy](https://discourse.elm-lang.org/u/dmy)\
**Post date:** [November 13, 2018, 9:22am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/2 "2018-11-13T09:22:29Z")

</div>

I usually just remove the direct dependency from `elm.json` then do `elm install author/package` again to let Elm generate dependencies.

---

<div class="post-metadata">

**Author:** ![malaire](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@malaire](https://discourse.elm-lang.org/u/malaire)\
**Post date:** [November 14, 2018, 3:27pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/3 "2018-11-14T15:27:32Z")

</div>

> [@dmy](#):
>
> I usually just remove the direct dependency from `elm.json` then do `elm install author/package` again to let Elm generate dependencies.

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`.

---

<div class="post-metadata">

**Author:** ![Libbum](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/libbum/32/1311_2.png) [@Libbum](https://discourse.elm-lang.org/u/Libbum)\
**Post date:** [November 14, 2018, 4:06pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/4 "2018-11-14T16:06:08Z")

</div>

Try removing `elm-stuff` too.

---

<div class="post-metadata">

**Author:** ![4onen](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/4onen/32/511_2.png) [@4onen](https://discourse.elm-lang.org/u/4onen)\
**Post date:** [November 14, 2018, 4:11pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/5 "2018-11-14T16:11:49Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![malaire](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@malaire](https://discourse.elm-lang.org/u/malaire)\
**Post date:** [November 14, 2018, 4:21pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/6 "2018-11-14T16:21:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [November 14, 2018, 5:25pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/7 "2018-11-14T17:25:57Z")

</div>

> [@malaire](#):
>
> 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.

Its just not a mature tool yet.

```
The dependencies in your elm.json are not compatible.

```

But which ones? Elm errors are famously helpful, but not this one.

Can the community help out here? Would it at least be productive to have a discussion on what features `elm init` needs to support to be usable?

---

<div class="post-metadata">

**Author:** ![dmy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dmy/32/702_2.png) [@dmy](https://discourse.elm-lang.org/u/dmy)\
**Post date:** [November 14, 2018, 6:38pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/8 "2018-11-14T18:38:14Z")

</div>

> [@malaire](#):
>
> 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).

> [@Libbum](#):
>
> Try removing `elm-stuff` too.

I don’t think this is needed.

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/sebastian/32/98_2.png) [@Sebastian](https://discourse.elm-lang.org/u/Sebastian)\
**Post date:** [November 16, 2018, 5:03am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/9 "2018-11-16T05:03:02Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![razze](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/razze/32/1650_2.png) [@razze](https://discourse.elm-lang.org/u/razze)\
**Post date:** [November 18, 2018, 10:34pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/10 "2018-11-18T22:34:42Z")

</div>

Another odd thing I found the other day is this error message pointing to elm reactor for dependency changing and stuff. [https://github.com/elm/compiler/blob/a6568a63f3ffc4defdb608d180b23a0113a89342/builder/src/Reporting/Exit/Deps.hs#L104-L108](https://github.com/elm/compiler/blob/a6568a63f3ffc4defdb608d180b23a0113a89342/builder/src/Reporting/Exit/Deps.hs#L104-L108)

I don’t think it’s possible right now, is it?

---

<div class="post-metadata">

**Author:** ![andys8](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/andys8/32/280_2.png) [@andys8](https://discourse.elm-lang.org/u/andys8)\
**Post date:** [November 19, 2018, 7:39pm UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/11 "2018-11-19T19:39:37Z")

</div>

I’d guess adding a patch to the compiler is probably the best solution, even if wouldn’t get merged. [https://github.com/elm/compiler/issues/1831#issuecomment-439930671](https://github.com/elm/compiler/issues/1831#issuecomment-439930671)

---

<div class="post-metadata">

**Author:** ![Augustin82](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/augustin82/32/1591_2.png) [@Augustin82](https://discourse.elm-lang.org/u/Augustin82)\
**Post date:** [November 29, 2018, 9:26am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/12 "2018-11-29T09:26:10Z")

</div>

We’re having trouble updating to http 2.0.0 as well… We’ll try using the tips in this thread, but surely the package manager should be more helpful =)

---

<div class="post-metadata">

**Author:** ![debudda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/debudda/32/1898_2.png) [@debudda](https://discourse.elm-lang.org/u/debudda)\
**Post date:** [December 1, 2018, 6:54am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/13 "2018-12-01T06:54:29Z")

</div>

I’ve managed to update elm/http by updating my elm binary. Don’t know if this is a correlation or a causation though

---

<div class="post-metadata">

**Author:** ![jerith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/jerith/32/114_2.png) [@jerith](https://discourse.elm-lang.org/u/jerith)\
**Post date:** [December 7, 2018, 3:48am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/14 "2018-12-07T03:48:08Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [December 17, 2018, 3:48am UTC](https://discourse.elm-lang.org/t/how-do-your-upgrade-a-package-in-your-app/2505/15 "2018-12-17T03:48:14Z")

</div>

Closed on December 17, 2018, 3:48am UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
