gocha124の日記

ごちゃごちゃ書きます

Node.jsのインストール

Qiitaを参考に自分のMacにNode.jsをインストールしました。
手順を書いておきます。

Homebrewのインストールする。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

エラーになった。メッセージに出力された内容を実行。

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
/usr/local/bin/brew update --force --quiet

nodebrewのインストールする。
Homebrewを使用してインストールする。

brew install nodebrew
nodebrew -v
nodebrew setup

202105 % nodebrew setup
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew

========================================
Export a path to nodebrew:

export PATH=$HOME/.nodebrew/current/bin:$PATH
========================================

Node.jsのインストールする。

nodebrew install-binary latest

インストールしたnodeを有効化する。

nodebrew ls
nodebrew use v16.2.0

環境パスに通す。

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

nodeが使えるか確認する。

node -v


qiita.com