2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Node.js】Please upgrade Node.js to version >=20.0.0 || >=22.0.0

Posted at

はじめに

Firebaseのインストールを試みたところ表題のエラーに遭遇しました。
今後も、versionの変更時にスムーズに対応できるよう備忘録として残します。

問題

Node.jsのバージョンをv.20にアップグレードしたい。

環境

Ubuntu 22.04.5 LTS

解決方法

以下の手順で解決しました。

1.Node.jsの現在のバージョンを確認

$ node -v

image.png

2.nvmコマンドのインストール

  • nvmコマンドがインストールされているか確認。コマンドがあればスキップ
$ nvm --version
$ command -v nvm
  • 結果が空の場合、使用しているシェルを確認
    設定ファイルを開き、コードを追加する
$ echo $SHELL
~/.bashrc
# 設定ファイルを開く
$ nano ~/.bashrc
# 設定ファイルの下のほうに以下の行があるか確認、ない場合は追加
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# 設定ファイル再読み込み
$ source ~/.bashrc

3.NodeSourceリポジトリを追加

$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

setup_20.xはアップグレードしたいバージョンを指定(v22の場合、setup_22.x

4.Node.jsをアップグレード

$ sudo apt-get install -y nodejs

5.Node.jsのバージョンを確認

$ node -v

6.変わっていない場合、nvmコマンドでバージョンを変更

$ nvm install 20
$ nvm use 20
# 再度バージョンを確認
$ node -v

おわりに

今回のエラーは1か月前にfirebaseの設定を行い、再度を試みたところ遭遇したエラーになります。
1か月でバージョンアップを求められ、技術の移り変わりの速さを実感しました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?