notes.dt.in.th

By default, Next.js development server runs on port 3000.

If you want to change the port to, e.g. 3001, update the package.json:

{
  "scripts": {
    "dev": "next dev -p ${PORT:-__PORT__}"
  }
}

A yq command to update the package.json:

yq eval '.scripts.dev = "next dev -p ${PORT:-__PORT__}"' package.json -i -P -o json