티스토리 뷰

React

[React] 리액트 시작하기

바켠주 2024. 6. 19. 20:13
728x90

리액트 환경 구축

1. Node.js 설치

https://nodejs.org/en

 

Node.js — Run JavaScript Everywhere

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

nodejs.org

 

설치 후 cmd창이나 git bash에 node -v 명령어를 사용해 잘 설치되었는지 확인한다.

node -v

버전확인

2. VSCode 설치

https://code.visualstudio.com/Download

 

Download Visual Studio Code - Mac, Linux, Windows

Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.

code.visualstudio.com

 

텍스트 편집기를 설치한다.

 

3. npm 설치

vscode 터미널에서 아래 명령어를 입력해 설치한다.

npm remove npm
npm install npm

리액트 프로젝트 생성

vscode의 bash 터미널에서 생성한다.

터미널 열기 : ctrl + `

npx create-react-app 프로젝트명

프로젝트 실행

npm start

명령어를 입력하면 브라우저에 새로운 웹페이지가 실행된다.

 


에러 해결

1. 만약 node를 설치하기 전에 vscode를 설치하고 실행한 경우

bash: npm: command not found 

이런 오류가 뜬다면 vscode를 재시작하면 된다.

 

2. react 프로젝트를 생성하는데 아래와 같은 오류가 뜨는 경우

npm uninstall -g create-react-app //1.삭제

npm install -g create-react-app //2.설치

npx create-react-app 파일명 //3.생성

삭제하고 재설치한다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함