npx create-react-app my-app을 실행하게 되면
D:\projects\front-react>npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
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/
npm ERR! code 1
npm ERR! path D:\projects\front-react
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-react-app "my-app"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\SP210422\AppData\Local\npm-cache\_logs\2022-01-19T00_15_49_320Z-debug-0.log
에러에서 나온 해결방법을 보자.
npm uninstall -g create-react-app
yarn global remove create-react-app
두가지 다 실행해서 해봤지만 같은 에러가 나온다.
그래서 구글링으로 해결방법을 찾았다.
- npm uninstall -g create-react-app
- npm add create-react-app
- 다시 npx create-react-app myapp
한번은 가능하지만 또 같은 에러가 나왔다. 근본적인 해결책이 아니였다.
근본적인 해결책을 스택오버플로우에서 찾았다.
npx clear-npx-cache
이 명령어를 실행해서 캐시를 날려주면 제대로 동작하게 된다.