0
0

More than 1 year has passed since last update.

ng new my-appでのエラーを解決する方法

Posted at

Angular公式の基礎講座のようなものをやろうとしたときに、ng new my-appというコマンドを叩いたらエラーが出た。

ng new my-appを叩いた時のエラー

$ ng new my-app
^[[ANode.js version v16.2.0 detected.
The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions.

このようなエラー。翻訳してみるとこのような内容だった。

Angular CLIには、Node.jsのバージョンが最低でもv12.20、v14.15、またはv16.10のいずれかが必要です。

Node.jsのバージョンを更新するか、https://nodejs.org/ で詳しい説明をご覧ください。

解決手順

$ nodebrew ls-remote
インストール可能なバージョンを確認する。

$ nodebrew install-binary v16.10.0
希望のバージョンをインストールする。 v16.10.0をインストールした。

$node -v
v16.10.0

これでv.16.10.0というバージョンをインストールすることができた。

これでngコマンドというものが使えるようになったっぽい。

ngコマンドを実行してみる

$ ng new my-app
? Would you like to add Angular routing? Yes

おー。動くようになった。

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