iiiuuuu
iiiuuuu

Reputation: 11

next.js cannot be started

To set up the next.js environment, we ran the commands in the following order.
After running it, I ran yarn dev but got an error.

error

warning package.json: No license field
error Command "dev" not found.

Command executed

・yarn create next-app
・yarn add next react react-dom
・touch tsconfig.json
・yarn add --dev typescript @types/react @types/node

package.json

{
  "name": "nextapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "next": "10.0.4",
    "react": "17.0.1",
    "react-dom": "17.0.1"
  }
}

Upvotes: 0

Views: 407

Answers (1)

Magofoco
Magofoco

Reputation: 5446

In your "scripts" modify the "dev" from "dev": "next dev" to "dev": "next".

"scripts" should look like:

  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start"
  }

Upvotes: 1

Related Questions