Search code examples
dependencieselm

install packages from elm.json


pe

The system has elm installed, and trying to install packages from elm.json.

What is the procedure to install packages from the elm.json directly?

currently, I have to install independently one by one.

elm install elm/http


Solution

  • Running elm install command without any input will give the following hint

    Hint: In JavaScript folks run npm install to start projects. "Gotta download everything!" But why download packages again and again? Instead, Elm caches packages in /Users/kaskelotti/.elm so each one is downloaded and built ONCE on your machine. Elm projects check that cache before trying the internet. This reduces build times, reduces server costs, and makes it easier to work offline. As a result elm install is only for adding dependencies to elm.json, whereas elm make is in charge of gathering dependencies and building everything. So maybe try elm make instead?

    As the tip says, elm make is probably what you need.

    If your elm cache is missing some dependencies, they are downloaded as needed.