How to use Elm on an air-gapped machine

I am starting out with Elm and wrote my first small web-app. Works great. Love the Haskell-ish feel to it :slight_smile:

At work I would like to develop small in-house web apps with Elm as well, however the machine I am developing on is air-gapped from the Internet. How can I run the elm command there? Can I tell it somehow to find pack list and packages in a certain directory on the file system?

Many thanks for any pointers!

PS: Not sure whether it makes a difference for Elm, but we have a local Sonatype Repo for npm packages… I guess Elm packages are not mirrored on npm, or are they?

1 Like

Elm searches first (when installing) ELM_HOME, which defaults to ~/.elm. You could install/copy the necessary packages once and then copy them to your air gapped machine and you could set ELM_HOME to be whatever directory you want.

Elm packages aren’t mirrored on npm either.

4 Likes

Thanks @wolfadex

Makes sense.

Do I just copy ~/.elm/0.19.1/packages/elm from an internet-connected machine to the home directory of the air-gaped machine?

I think you want to copy either the whole of ~/.elm to your air gapped machine. Where you copy it is up to you. If you put it anywhere other than ~/, then you’ll also need to set the env var ELM_HOME to point to that location.

You can also copy as much or little as you want. If you want every package & version you’ve ever installed on your Internet connected machine, then copy the whole directory. If you only want the necessary packages + versions, then you can just copy those.

You might also notice that the package directories include that package’s docs as a JSON file. There are some tools that will display those the same as the website, giving you offline docs!

2 Likes

GitHub - dmy/elm-doc-preview: Elm offline documentation previewer excellent tool, really useful :slight_smile:

3 Likes