0
0

More than 1 year has passed since last update.

Node.jsのバージョンアップ

Last updated at Posted at 2022-02-01

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の新規プロジェクトを作成することができました。
ありがとうございました。

0
0
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
0
0