developers blog

Windows7 に nodist を利用して node.js + npm をインストールする

はじめに

Windows7 に、nodist を利用して node.js + npm をインストールします。

環境

  • OS : Windows 7 Pro 64bit
  • その他 : nodist 0.8.8

nodist とは

nodist は、Windows 用の node.js および npm のバージョンマネージャーです。nodist を利用することにより、node.js のインストールやバージョンの管理が、簡単にできるようになります。

nodist のインストール

nodis tのダウンロード 以下のページより、インストールするバージョンのインストーラーをダウンロードします。

nodist

nodist のインストール

ダウンロードした exe ファイルを実行し、Windows に nodist をインストールします。インストール時に環境変数にパスが設定されるので、インストール終了後 PC を再起動します。

node.js のインストール

コマンドプロンプトを開き、以下のコマンドで node.js のバージョンを指定してインストールします。

1> nodist <version>

利用できるバージョンを確認するには、以下のコマンドを実行します。

1> nodist dist
2......
3 7.4.0

6.9.4 をインストールする場合は、以下のコマンドを実行します。

1> nodist 6.9.4
26.9.4
3Installing 6.9.4
4 6.9.4 [===============] 18079/18079 KiB 100% 0.0s
5Installation successful.

最新の node.js をインストールする場合は、以下のようにします。

1> nodist latest

インストールされた node.js のバージョンを確認するには、以下のコマンドを実行します。

1> nodist ls
2  6.9.4
3> 7.4.0 (global: latest)

使用する node.js のバージョンを切り替える場合は、インストールされているバージョンを指定してコマンドを実行します。

1> nodist env 6.9.4
2> nodist ls
3> 6.9.4 (global: 6.9.4)
4  7.4.0

node.js が正常にインストールされているか確認するために、以下のコマンドを入力してみます。

1> node -v
2v6.9.4

npm の設定

npm を使用するために、以下のコマンドを実行します。

1> nodist npm global match

npm が使用できるか確認するために、バージョンを表示してみます。

1> npm -v
23.10.10