I created a Next.js app using npx create-next-app@latest
, pushed the new app to a GitHub repository, then cloned the repository into a new directory. When I tried to run the app using npm run dev
, I got the following output:
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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?
I was expecting the development server to start. How can I run my app?
CodePudding user response:
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
run : npm install
CodePudding user response:
the last line from you error stack is telling you the problem Your projet has an package.json but you didn't install your dependencies
You should install before trying to run you project running npm install and then npm run dev
https://docs.npmjs.com/cli/v9/configuring-npm/package-json
if you want to know more about package.json