본문 바로가기

Frontend study/정리 및 기록

npx create-react-app 설치 에러

 create-react-app을 사용해서 리액트 프로젝트를 새롭게 구성하려고 

 설치하는 도중 다음과 같은 에러를 발생했다. 

 

 

 

이와 같은 에러가 생겼다. 

설치해야하는데 뭐 글로벌로 설치한 create-react-app이 이전 버전이니 

최신 버전으로 설치해야한다는 그런 의미인거 같다. 

 

그래서 stackoverflow 에 검색해서 다음과 같은 해결방법을 찾았다. 

 

해결하는 방법 (아래 순서로 진행하면 된다.)

 첫번째: 전역으로 설치된 create-react-app을 일단 지운다. 

   - npm -g ls 명령어로 지워졌는지 확인 

    npm uninstall -g create-react-app 

 

 두번째: - 다시 전역으로 create-react-app을 설치한다. 
   npm install -g create-react-app 

   

 세번째: - npx로 create-react-app 새 프로젝트 생성하기 

   npx create-react-app 

 

  아래와 같이 나오면 설치 완료!!

  

 - 설치완료후 실행해보기

  npm start 

 

 

 정리하자면  전역으로 설치된 이전 create-react-app을

 지우고 다시 설치해서 최신 버전으로 진행하면 된다.

 

 끝.

 

 

 

 

 

 참조 stackoverflow

 

I can't install react using npx create-react-app?

I am trying to use npx create-react app but i have errors that is shown below: npm ERR! Unexpected end of Json input while parsing near '...eact-app/-/create-rea' npm ERR! A complete log of this ...

stackoverflow.com

 

'Frontend study > 정리 및 기록' 카테고리의 다른 글

React@18과 react-router-dom@5의 호환성 문제  (0) 2022.07.15
CRA에서 절대경로 설정하기  (0) 2022.07.02
React Proxy 설정하기  (0) 2022.06.22
HTTP 프로토콜  (0) 2022.02.27
JSON Server 사용해보기  (0) 2022.02.25