Nextの新規プロジェクトを作ろうとしたとき、Nodeのversionが古い!と怒られたのでメモです。
nodebrewを利用して、Node.jsをバージョンアップします。
現在のnodeのversion確認
$ node -v
v10.3.0
nodebrewをインストール
$ brew install nodebrew
インストールできたか確認
下記のように表示されればOKです
$ nodebrew -v
nodebrew 1.1.0
セットアップ
$ nodebrew setup
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew
========================================
Export a path to nodebrew:
export PATH=$HOME/.nodebrew/current/bin:$PATH
========================================
bash_profileにパスを設定
$ vi ~/.bash_profile
export PATH=$HOME/.nodebrew/current/bin:$PATH ##追加
bash_profileの変更を反映させる
source ~/.bash_profile
nodeのインストールできるバージョンを確認
ずらーっとバージョンが表示されます
どのバーションにアップデートするか下記を見て判断してください。
https://nodejs.org/ja/
$ nodebrew ls-remote
インストール
現時点でv16.13.2が推奨版とのことだったのでインストールします
$ nodebrew install v16.13.2
使用するバーションを決める
$ nodebrew use v16.13.2
アップデートできたか確認
アップデートしたいバージョンにすることができました
$ node -v
v16.13.2
終わり
Nextの新規プロジェクトを作成することができました。
ありがとうございました。