ProgramJavaScriptAltJSElmElmガイド > インストール


インストール

Elmにはインストーラーが用意されているので、それを使えば手軽にインストールできます。

インストーラーのダウンロード

Windowsの場合

「installer-for-windows.exe」というインストーラーをダウンロードして、ダブルクリックすれば、Elmをインストールできます。

動作確認

コマンドプロンプトを起動して、「elm」というコマンドを入力してみます。

C:\Users\username>elm
Hi, thank you for trying out Elm 0.19.1. I hope you like it!

-------------------------------------------------------------------------------
I highly recommend working through <https://guide.elm-lang.org> to get started.
It teaches many important concepts, including how to use `elm` in the terminal.
-------------------------------------------------------------------------------

The most common commands are:

    elm repl
        Open up an interactive programming session. Type in Elm expressions like
        (2 + 2) or (String.length "test") and see if they equal four!

    elm init
        Start an Elm project. It creates a starter elm.json file and provides a
        link explaining what to do from there.

    elm reactor
        Compile code with a click. It opens a file viewer in your browser, and
        when you click on an Elm file, it compiles and you see the result.

There are a bunch of other commands as well though. Here is a full list:

    elm repl    --help
    elm init    --help
    elm reactor --help
    elm make    --help
    elm install --help
    elm bump    --help
    elm diff    --help
    elm publish --help

Adding the --help flag gives a bunch of additional details about each one.

Be sure to ask on the Elm slack if you run into trouble! Folks are friendly and
happy to help out. They hang out there because it is fun, so be kind to get the
best results!

といったような表示が出て来たら、ElmのインストールはOKです。

エディターの設定

Windows10+Visual Studio CodeでElmを使う場合の設定方法が紹介されていました。

Nodistを使っている場合の注意点

WindowsにNode.jsをインストールするとき、Nodistを使っている場合は、npmのパスが通常とは違っている場合があるので注意が必要です。

  • Node.jsの公式インストーラーを使った場合のnpm
  • Nodistを使った場合のnpm

npmでElmをインストールする方法が、若干変わって来るので、以下の方法を試みてみます。

npmのパスを確認

  • Node.jsのPath(パス)を確認する方法【初心者向け】 | TechAcademyマガジン https://techacademy.jp/magazine/16113

    npmのPATHを確認する方法

    npm bin -g

    表示結果

    C:\Users\ユーザー名\AppData\Roaming\npm

NodistでNode.jsを入れた場合はnpmのパスが以下のようになっているはずです。

C:\Program Files (x86)\Nodist\bin

Windowsのコマンドプロンプトで、以下のコマンドを入力して、npm.exeがあるフォルダに移動します。

cd C:\Program Files (x86)\Nodist\bin

ここで、npmコマンドでElmをインストールすればOKです。

npm install -g elm

ついでに、elm-formatも入れます。

npm install -g elm-format

この後、Visual Studio CodeでElmを使うテストをしてみればOKです。


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019-11-07 (木) 00:34:52 (1625d)