nでNode.jsのバージョンを管理する

ルク
ルク
Aug 29, 2017 · 2 min read

インストール

nはNode.jsのバージョンを管理することができます。シンプルで使いやすいのでとてもオススメです。

https://github.com/tj/n

  • インストールする
$ npm install -g n
  • 使いたい nodeのバージョンをインストールする
$ n 6.4.0
$ n 7.10.0
$ n 8.4.0

※ Node.jsのバージョン一覧

  • nで管理(インストール)してるバージョンから切り替える
$ n
6.4.0
ο 7.10.0
8.4.0

o を上下(Vimのj, k)して使いたいバージョンを選択してエンターキーで決定する。
途中でやめたければ^C (control + C) で選択画面から戻れる

  • 公式の最新のバージョンをインストールする
$ n stable
  • LTS(Long Term Support)版をインストールする
$ n lts
  • 特定のバージョンをnから削除する
$ n rm 6.4.0 7.10.0
  • 現在使用中のバージョン以外全てのバージョンを削除する
$ n prune
)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade