본문 바로가기
Library-Framework/Next.js

[Next.js] 프로젝트 생성하기

by 그랴 2022. 12. 7.

1. 프로젝트 생성하기

- 타입스크립트 X

npx create-next-app@latest
# or
yarn create next-app
# or
pnpm create next-app

- 타입스크립트 O

npx create-next-app@latest --typescript
# or
yarn create next-app --typescript
# or
pnpm create next-app --typescript

2. next, react, react-dom 설치하기

npm install next react react-dom
# or
yarn add next react react-dom
# or
pnpm add next react react-dom

3. npm 설치하기

- 안하면 script 실행 시, "'next'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다." 이런 오류가 뜬다.

npm install

4. 서버 실행하기

npm run dev

5. 접속하기 

- 보통 http://localhost:3000/ 로 뜨긴 한다.

- 터미널 창에도 뜨니 확인하고 접속하면 된다.

이런 창이 뜬다 그럼 끝!

 

 

Getting Started | Next.js

Get started with Next.js in the official documentation, and learn more about all our features!

nextjs.org