10
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MacでNode.jsの環境構築をする

Last updated at Posted at 2019-07-05

何番線じか分かりませんがMacでNode.jsの導入メモです。
※記載されているバージョンは2019/7/4のものとなります。

Homebrewのインストール

Mac用のパッケージマネージャです。
下記のURLからスクリプトをコピーしてターミナルで実行してインストールします。

スクリーンショット 2019-07-05 19.21.39.png
https://brew.sh/index_ja.html

Homebrewのバージョン確認

$ brew -v

Homebrew 2.1.6
Homebrew/homebrew-core (git revision 33fa; last commit 2019-07-04)
Homebrew/homebrew-cask (git revision b3f55; last commit 2019-07-04)

nodebrewのインストール

Node.jsのバージョン管理ツールです。
以下のコマンドでインストールします。

$ brew install nodebrew

ディレクトリ作成

$ mkdir -p ~/.nodebrew/src

nodeBrewでNode.jsをインストール

最新版

$ nodebrew install-binary latest

安定版

$ nodebrew install-binary stable

PATHを通す

$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile

※PATHを通したらターミナル再起動します。

インストールされているかどうか確認

$ nodebrew ls

v12.6.0

current: none

currentがnoneとなっているので、
バージョンを指定する。

バージョン指定

$ nodebrew use v12.6.0

nodeのバージョンを確認する

$ node -V
v12.6.0

バージョンが表示されれば無事完了です。

10
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?