Home > Back-end >  "npm run dev" works, but "next dev" does not
"npm run dev" works, but "next dev" does not

Time:08-17

I'm trying Next for the first time (with npx create-next-app), but I'm not getting the scripts to work. npm run dev works fine, but next dev outputs zsh: command not found: next. Why is this?

I'm on macOS 12.5, M1. Node version 16.13.1.

It works when I use the debug tool in VS Code.

package.json:

{
  "name": "blog-next",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "12.2.5",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "eslint": "8.22.0",
    "eslint-config-next": "12.2.5"
  }
}

CodePudding user response:

You need to install the package globaly(system wide) npm -g install next

  • Related