Overview

Elm Friday: Installing Elm (Part II)

No Comments

About This Series

This is the second post in a series of short and sweet blog posts about Elm. The stated goal of this series is to take you from “completely clueless about Elm” to “chief Elm guru”, step by step. If you have missed the previous episodes, you might want to check out the table of contents.

Installing Elm

Now that we know what Elm is, we’re all eager to get our hands dirty with it right? There are actually multiple ways to install Elm. There are installers for Windows and Mac available on http://elm-lang.org/install. If you happen to use one of these operating systems, use the installers. The code in this tutorial has been tested with version 0.16.0 of the Elm platform.

You’re a bit out of luck on Linux, since there is no Linux installer. You could build Elm from source, but this would require you to install and set up the Haskell Platform (Elm is build in Haskell) which can be a real pain in the rear. The recommended way to get up and running on Linux is to install Elm via npm:

  • Make sure Node and npm are installed.
  • npm i -g elm@^0.16.0
  • That’s it.

Remark: Usually you would probably just install the latest version with npm install -g elm (without the version tag). Depending on when you read this post, this might install a newer Elm version and the code examples in this tutorial might not be working with it. Another remark, there might be some issues with the live reload in version 0.16.0 installed via npm, so if you want to give this a try, you should rather do npm install -g elm@0.15.1-beta4.

Of course installation via npm also works on OS X and Windows.

No matter how you installed Elm, you can (and should) test your Elm installation by typing

elm-make -h

which should produce a response like this:

elm-make 0.16 (Elm Platform 0.16.0)

Usage: elm-make [FILES...] [--output FILE] [--yes] [--report FORMAT] [--warn]
                [--docs FILE]
  build Elm projects

Available options:
  -h,--help                Show this help text
  --output FILE            Write result to the given .html or .js FILE.
  --yes                    Reply 'yes' to all automated prompts.
  --report FORMAT          Format of error and warning reports (e.g.
                           --report=json)
  --warn                   Report warnings to improve code quality.
  --docs FILE              Write documentation to FILE as JSON.

Examples:
  elm-make Main.elm                     # compile to HTML in index.html
  elm-make Main.elm --output main.html  # compile to HTML in main.html
  elm-make Main.elm --output elm.js     # compile to JS in elm.js
  elm-make Main.elm --warn              # compile and report warnings

Full guide to using elm-make at 

This concludes the second episode of this blog post series on Elm. Make sure to check out the next episode, where we finally start to get our hands dirty with some Elm code.

Comment

Your email address will not be published. Required fields are marked *