Motomichi Works Blog

モトミチワークスブログです。その日学習したことについて書いている日記みたいなものです。

create-react-appが失敗する問題に対処した「You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0). 」

参考にさせていただいたページ

失敗した操作

公式ページの「https://ja.reactjs.org/docs/create-a-new-react-app.html」にならって、以下のコマンドを実行しました。

npx create-react-app@latest my-app

すると以下のようなメッセージが表示されて、失敗しました。

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

標示された通りに以下のコマンドを実行してから、create-react-appしなおしても駄目でした。

yarn global remove create-react-app

バージョンを指定して実行する

"npx create-react-app my-app" stopped working in 4.0.3 · Issue #10601 · facebook/create-react-app · GitHub」にある通り、以下のように最新バージョンを指定して実行したら正常に完了しました。

npx create-react-app@latest my-app