#author("2019-11-09T00:53:39+00:00","default:sagasite","sagasite")
#author("2019-11-09T00:55:07+00:00","default:sagasite","sagasite")
[[Program]] > [[JavaScript]] > [[AltJS]] > [[Elm]] > [[Elmガイド>Elm_guide]] > インストール

#norelated
#contents

//----------------------------------------
~
* インストール [#sdd2977c]
-インストール · An Introduction to Elm https://guide.elm-lang.jp/install.html

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

**インストーラーのダウンロード [#x86f0033]
-Releases · elm/compiler · GitHub https://github.com/elm/compiler/releases/
ここから、自分が使っているOSに合わせて、インストーラーをダウンロードできます。

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

***動作確認 [#vd40e41c]
コマンドプロンプトを起動して、「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です。

*エディターの設定 [#e921789c]
Windows10+Visual Studio CodeでElmを使う場合の設定方法が紹介されていました。

-VS Code で Elm の開発環境を構築する on Windows 10 - Qiita https://qiita.com/ossan_pg/items/5c3ce00b74036139507e

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

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

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

***npmのパスを確認 [#t6f3e30d]
-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