Next
Initialization
# No installation required
npx create-next-app@latest [init-option]
Initialization options:
--no-<option>
(negate default value for a given option)--tailwind
(by default)--ts
,--typescript
(by default)--js
,--javascript
-e
,--example <name|github-url>
More at create-next-app (nextjs.org).
Installation
npm i next react react-dom
Usage
next <command> [option]
next dev
next build
next start
# Use with npm scripts
npm run dev
npm run build
npm start
// package.json e.g.:
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
}
Options for dev
and start
:
-p <number>
(or as an environment variablePORT=<number> npx next <command>
)-H <host>
More at Next.js CLI (nextjs.org).