Introduction
安装
Automatic Setup
We recommend creating a new Next.js app using create-next-app
, which sets up everything automatically for you. (You don't need to create an empty directory. create-next-app
will make one for you.) To create a project, run:
npx create-next-app@latest
# or
yarn create next-app
# or
pnpm create next-app
If you want to start with a TypeScript project you can use the --typescript
flag:
npx create-next-app@latest --typescript
# or
yarn create next-app --typescript
# or
pnpm create next-app --typescript
After the installation is complete:
- Run
npm run dev
oryarn dev
orpnpm dev
to start the development server onhttp://localhost:3000
- Visit
http://localhost:3000
to view your application - Edit
pages/index.js
and see the updated result in your browser
For more information on how to use create-next-app
, you can review the create-next-app
documentation.