D.evelop/React

[React]CRA설치 에러 A template was not provided. This is likely because you’re using an outdated version of create-react-app.

Danne 2021. 9. 21. 23:42

왜? 

왜 나만 뭐 설치하려고 할 오류나?😂

 

또 오류나면 다시 보려고 적어두는 기록✍️

(오류가 그래요. 해결했던 기억을 잊어 갈 때 쯤, 다시 찾아오더라고요.)

 


 

먼저 주어졌던 과제를 정리하면

✔️ node.js 설치
✔️ npm 설치
✔️ create-react-app 설치

이렇게 준비해야 했다.

 

 

[첫 실패🤯]

// node.js 버전 확인
node -v 

// npm 버전 확인
npm -v

 

우선 기존에 설치되었는지 확인하려 버전을 체크하니 지난 버전이 설치되어 있는 걸 확인하고 패스.

(어쩌면 이게 문제의 시발점이었다. '왜? 설치돼있지?'하고 의문을 안가진 것)

 

 

✨ 설치 방법 ✨

// 1. 설치할 경로로 진입
cd 설치할 디렉토리 경로

// 2. create-react-app 설치 
npx create-react-app 프로젝트명

// 3. 프로젝트 진입 
cd 프로젝트명

// 4. 로컬 서버 열어서 확인 (자동으로 열림)
npm start

여기서 4번...

4번에서 계속 막혔다. 정확히는 2번을 실패해서 실행이 안되는 것.

 

에러 메세지

A template was not provided. This is likely because you're using an outdated version of create-react-app.

 

일단 터미널이 무서워서, 내가 감당할 수 있는 선까지 해보자 싶었다.

삭제하고 다시 설치하는 정도.

프로젝트도 생성되고, 수많은 warning과 함께 모듈도 잔뜩 생성됐지만, 역시나 실행 되지 않는 프로젝트. 

 

 

[두 번째 실패🤯]

npm install -g create-react-app
create-react-app start-react-app

이번엔 뭔가 다른 화면. 뭔가 start할 수 있을 것 같은 문구가 떴지만. 실패.

뭘 Happy hacking! 하라는 건지😡

 

node.js와 npm탓인가 싶어 버전 업데이트를 하고 다시 시도. 안됨.

https://nodejs.org/ko/

 

Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

 

[세 번째 성공]

또 싹 지우고 에러 메세지를 검색하다가 한 줄기 햇살 같은 블로그 포스트 발견.

 

Yurim Jin, Programmer&Designer

npx create-react-app 에서 A template was not provided. This is likely because you’re using an outdated version of create-react-app. 에러가 날 때

 

npx create-react-app 에서 A template was not provided. This is likely because you’re using an outdated version of create-rea

Problem CRA 공식 문서대로 npx create-react-app my-app 명령어를 입력했는데 A template was not provided. This is likely because you’re using an outdated version of create-react-app. 에러가 나면서 빈 react app이 생성되었다…

milooy.wordpress.com

 

// 설치된  create-react-app 찾기
which create-react-app

// 그 create-react-app 경로 찾아가 지우기
rm -rf /usr/local/bin/create-react-app

Yurim Jin님의 방법대로 했으나  which로 검색을 해도 아무 것도 나오지 않았다.

 

 

 

https://create-react-app.dev/docs/getting-started/

 

Getting Started | Create React App

Create React App is an officially supported way to create single-page React

create-react-app.dev

일단 "더 이상 global로 설치된 create-react-app 을 지원하지 않는다"는 키워드를 얻음과 동시에 '아! 나 2년전에 리액트 설치 했었지?'하는 기억이 떠올랐다.

 

당시에 php와 react를 사용할 거니 공부해두라는 회사의 지령(?)을 받고 이리저리 설치했었던 것.

php가 너무 강렬해서 잊고 있었던, 나의 create-react-app...😥

그 때 velopert 님 글 보고 yarn도 설치했던 어렴풋한 기억.

그럼 어쨌든 which가 찾아줘야하는 거 아님?😂

그런데 내가 무슨 이름으로 만들었는지 기억이 안나서 수동으로 찾기로 했다.

cd, ls 의 반복 중 어딘가에서 hello-react 발견!

rm -rf 디렉토리명

싹싹 지워주기
이제 조금 친근해진 터미널.

 

깔끔하다. 뭔가 될 것 같은 기분이다.

 

성공!

 

반응형