React (Front-end)

npx create-react-app 실행시 "We no longer support global installation of Create React App"이 발생

공청 2022. 12. 12. 22:49
반응형

 

 

 

1. 들어가는 글

 

오랜만에 개발하려고 하니까 죽겠다.

 

거두절미하고 해당 오류는 create-react-app을 전역으로 설치해놓아서 발생하는 오류이다.

 

글로벌로 설치된 모듈을 삭제하자.

 

npm uninstall -g create-react-app
yarn global remove create-react-app

 

이후에 create-react-app을 다시 로컬로 설치한다.

add create-react-app

 

이제 create-react-app으로 프로젝트를 설치할 수 있게 되었다.

create-react-app의 리액트 프로젝트를 바로 할 수 있다는 장점이 있지만, 이렇게 설치하는 경우 node_modules가 이중으로 중첩되어 생긴다는 문제점이 있다.

 

최상위폴더

ㄴnode_modules (방금 우리가 add한 create-react-app이 설치된 모듈들)

 ㄴ 내가 만든 프로젝트

   ㄴnode_modules (create-react-app이 데리고 온 react, react-dom, react-scripts, web-vitals 모듈들)

 

단일 프로젝트만 구성하려면 상위 프로젝트를 지우고 .gitignore를 한 이후에 커밋하면 된다.

 

 

(그런데 앞으로는 create-react-app 안 쓸 예정이다.)

 

 

 

 

참고할만한 글

1. Create-React-App 사용하지 마세요.

https://dev.to/nikhilkumaran/don-t-use-create-react-app-how-you-can-set-up-your-own-reactjs-boilerplate-43l0

 

Don't use create-react-app: How you can set up your own reactjs boilerplate.

What is CRA? Create React App is a toolchain built and maintained by developers at Faceboo...

dev.to

 

2. 새로운 리액트 애플리케이션을 만드는 7가지 방법

https://blog.bitsrc.io/6-best-ways-to-create-a-new-react-application-57b17e5d331a

 

7 Best Ways to Create a New React Application

Make the right decisions and choose wisely how to start your new react application.

blog.bitsrc.io

 

끝!

반응형