1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

firebaseでアップデートが必要と言われる。Firebase CLI v14.2.0 is incompatible with Node.js v18.16.0 Please upgrade Node.js to version >=20.0.0 || >=22.0.0

Last updated at Posted at 2025-04-21

はじめに

firebaseにアプリを deploy しようとすると、Node.jsのバージョンと互換性がないといわれたのでNode.jsをアップデートし互換性を解決するまでの過程を共有します。

■環境
Linux

問題

firebase login を実行すると下記のようなエラー出ます。

Firebase CLI v14.2.0 is incompatible with Node.js v18.16.0 Please upgrade Node.js to version >=20.0.0 || >=22.0.0

Firebase CLI v14.2.0 は、Node.js v18.16.0 と互換性がないため、Firebase CLIのバージョンアップ、またはNode.jsのバージョンアップが必要です。と指摘されています。

Node.js(ver.20.0.0以上またはver.22.0.0以上)にしてくださいと書いてあるので、バージョンアップしていきます。

解決方法

Node.js(ver.22.0.0)にアップデートします。

この機会に、nodebrewでnode.jsのバージョンを管理しようと思ったので今回はnodebrewを使用してバージョンアップをします

Homebrew🍺を入れる

https://qiita.com/tetusan/items/f2ca37147aafe28f7884
を参考にしました。

まず、LinuxにHomebrewを入れていきます。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

https://docs.brew.sh/Homebrew-on-Linux に従いながら引き続き作業していきます。
以下を順番に実行します。

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
#Homebrewが入っている確認
brew install hello

これでLinuxにHomebrew🍺を入れることが出来ました!

nodebrewを入れる

■インストール

brew install nodebrew

■確認

# バージョンが確認できればOK
nodebrew -v

■環境変数を追加する
vi ~/.bash_profile で、以下を追加する。

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

:wq でvimを保存して終了。※キーボード入力してください。

bash_profile を更新して設定を反映させます。

source ~/.bash_profile

セットアップ。これやらないとインストールできません。

nodebrew setup

バージョンを指定してNode.jsをインストールする

■インストール可能なバージョンを確認します。

nodebrew ls-remote

■nodeのインストール※今回はver.22.0.0をインストールします。

nodebrew install-binary v.22.0.0

■インストールしたバージョンを確認します。

nodebrew ls

■使いたいバージョンを指定します。

nodebrew use v22.0.0

もう一度 nodebrew ls を叩いて、currentが指定されてればOKです。

最後に
node -v でバージョンが表示されれば完璧です!!

firebaseにログインする

そして firebase login を実行すると、、
? Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Yesと出てきました。成功です!

おわりに

最初に直でアップデートしようとして、失敗しました。
これからはnodebrewで管理できると思うと楽です(笑)

参考

https://qiita.com/mame_daifuku/items/373daf5f49ee585ea498
https://qiita.com/tetusan/items/f2ca37147aafe28f7884
https://docs.brew.sh/Homebrew-on-Linux

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?