react 수업

2. react-react-app를 vs code에서 실행하기

gongmille 2024. 8. 29. 15:08

terminal을 실행한다.

 

그럼 하단에 터미널 창이 뜬다.

 

npx create-react-app my-app 명령어를 입력. 여기서 my-app은 폴더 명임

 

*오류발생*

npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\user\AppData\Roaming\npm'

 

해당 경로가 존재하지 않음. 

Roaming 폴더 아래에 npm 폴더가 없어서 생긴 오류. 이름이 같은 폴더를 만들어둬도 괜찮기 때문에 생성함.

 

이후 정상작동.

 

빈 폴더이기 때문에 설치를 하겠냐는 질문이 뜸

 

Need to install the following packages:
create-react-app@5.0.1
Ok to proceed? (y) y

 

y를 쳐서 설치를 진행하면 명령어들을 알려준다.

 

npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

 

그리고 아래에 해당 명령어를 적으라고 안내해준다.

 

We suggest that you begin by typing:

  cd my-app
  npm start

 

cd my-app 은 해당 폴더로의 이동을 의미한다.

npm start를 누르고 기다리면 react localhost 페이지가 뜬다

 

tomcat을 연결해서 처음 오픈했던 것처럼 뜬다.

'react 수업' 카테고리의 다른 글

6.state와 lifecycle  (1) 2024.09.03
5. components, props  (0) 2024.09.02
4. rendering elements  (0) 2024.08.31
3. jsx와 createElement  (0) 2024.08.31
1. 실제 리액트 연동하기  (0) 2024.08.29