-
React 프로젝트 설치 환경 세팅IT/React 2022. 4. 25. 17:20
- 1. Node.js 설치
- 2. React 패키지 설치
- 2.1. 터미널에서 npx create-react-app 폴더이름
Window의 경우 react-app 패키지가 바로 설치 안될 수 있는데 그럴때에는
1. 검색 창에 Window powerShell 검색
2. 바로 열지말고 오른쪽 클릭 하고 관리자 권한으로 실행
3. powerShell 입력창에 Set-ExecutionPolicy Unrestricted 입력
4. y 입력하고 다시 npx create-react-app 실행그래도 안되는 경우
npm WARN exec The following package was not found and will be installed: create-react-app You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.1).
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
해당 문제로 npm uninstall -g create-react-app 이렇게 하고 다시해도 의미가 없다.
1. npm add create-react-app
2. npx create-react-app myapp
실행하면 에러 해결폴더
- node_modules : 라이브러리 코드 보관함
- public : image, html 같은 것 보관 static 한 데이터 보관
- src : 우리의 소스코드 보관함
파일
- App.js -> 우리가 코드로 작성한 것을 구현 해주는 js
- App.js -> index.html 로 보내는 것이 돌아가는 구조가 이미 짜여있다.
- package.json -> 프로젝트 정보들을 기입해놓는 곳 (라이브러리, 패키지들 버전 기입)
또 다른 해결방법
npx create-react-app@latest project-name --template typescript 지정해주자'IT > React' 카테고리의 다른 글
[React] State, Props, map에 대한 개념 (0) 2022.04.28 [React] JSX, State, Array, Object, Event handler 정리 (0) 2022.04.25 2022_01_06 React 합성vs상속 (0) 2022.01.06 2022_01_06 React Form (0) 2022.01.06 2021_12_30 React 마지막 특강 + 정리 (0) 2021.12.30