'Error while running "npm start": 'next' is not recognized as an internal or external command,

I am having this error while running "npm start" command on terminal as I am trying to build a cryptocurrency tracker using React.js

my package.json file


{
  "name": "nextjs-crypto-api",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "11.1.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "webpack": "^5.51.1"
  },
  "devDependencies": {
    "eslint": "7.32.0",
    "eslint-config-next": "11.1.0"
  },
  "description": "This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).",
  "main": "next.config.js",
  "author": "",
  "license": "ISC"
}


Error:-

'next' is not recognized as an internal or external command, operable program or batch file.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: next start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\LENOVO\AppData\Roaming\npm-cache_logs\2021-08-20T16_58_19_379Z-debug.log

Please help me with this error



Solution 1:[1]

Please read your WARNING first

npm WARN Local package.json exists, but node_modules missing, did you mean to install?

That means you are trying to run the project without installing the node_modules beforehand.

So, you should be doing - first

npm i

and then

npm start

Solution 2:[2]

Seems like the issue with modules. I am not sure but try deleting your package-lock.json file and node_modules folder and then try below commands:

npm cache clean --force

and then again run

npm i or npm install

Solution 3:[3]

Same issue here until I realized I had an outdated version of Node.js installed.

Make sure to install the latest version of Node.js, then delete both the node_modules folder and package-lock.json file in your project.

Reinstall the node_modules:

npm install

Then run it using:

npm run dev

The above command is different from npm start because you're using Next.js

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Md. Minhaz Ahamed
Solution 2 sm_dev2
Solution 3 Colton McEwen