리액트 새 프로젝트 만들기 기초
1. 터미널 열고(Git Bash) 아래 명령어 실행하기
npx create-react-app begin-react
npx create-react-app begin-react
예를 들어 워크스페이스 폴더 생성부터 한다면 아래와 같이 진행한다.
1. cd d:
2. mkdir react-workspace
3. cd react-workspace
4. npx create-react-app begin-react
2. mkdir react-workspace
3. cd react-workspace
4. npx create-react-app begin-react
아래와 같이 수행된다.
thkmon@thkmonpc MINGW64 ~
$ cd d:
thkmon@thkmonpc MINGW64 /d
$ mkdir react-workspace
thkmon@thkmonpc MINGW64 /d
$ cd react-workspace/
thkmon@thkmonpc MINGW64 /d/react-workspace
$ npx create-react-app begin-react
npm WARN exec The following package was not found and will be installed: create-react-app@5.1.0
Creating a new React app in D:\react-workspace\begin-react.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1324 packages in 1m
271 packages are looking for funding
run `npm fund` for details
Initialized a git repository.
Installing template dependencies using npm...
added 17 packages, and changed 1 package in 8s
271 packages are looking for funding
run `npm fund` for details
Removing template package using npm...
removed 1 package, and audited 1341 packages in 5s
271 packages are looking for funding
run `npm fund` for details
27 vulnerabilities (24 moderate, 3 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Created git commit.
Success! Created begin-react at D:\react-workspace\begin-react
Inside that directory, you can run several commands:
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 begin-react
npm start
Happy hacking!
$ cd d:
thkmon@thkmonpc MINGW64 /d
$ mkdir react-workspace
thkmon@thkmonpc MINGW64 /d
$ cd react-workspace/
thkmon@thkmonpc MINGW64 /d/react-workspace
$ npx create-react-app begin-react
npm WARN exec The following package was not found and will be installed: create-react-app@5.1.0
Creating a new React app in D:\react-workspace\begin-react.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1324 packages in 1m
271 packages are looking for funding
run `npm fund` for details
Initialized a git repository.
Installing template dependencies using npm...
added 17 packages, and changed 1 package in 8s
271 packages are looking for funding
run `npm fund` for details
Removing template package using npm...
removed 1 package, and audited 1341 packages in 5s
271 packages are looking for funding
run `npm fund` for details
27 vulnerabilities (24 moderate, 3 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Created git commit.
Success! Created begin-react at D:\react-workspace\begin-react
Inside that directory, you can run several commands:
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 begin-react
npm start
Happy hacking!
이어서 생성된 begin-react 폴더 안에 들어가서 npm start 실행하면
http://localhost:3000/ 로컬호스트에 서버가 뜬다.
1. cd begin-react
2. npm start
2. npm start