I've cloned a nextjs example repo locally, and tried to run it using npm run dev
, but it's not finding "next" as a command?
sh: next: command not found
I googled it, suggestions seemed to be that I should run
npm i -g create-next-app
Which I did, but still get the same error?
How can I resolve this?
For my particular case, I forgot to run npm install
in the repo I'd just cloned :D
Once I did that, running npm run dev
worked fine and found next
.
But I suspect in general if you're trying to run a cloned repo based on npm, and get a similar response, you may simply have forgotten to install your dependencies, like I did.
Note that this can also happen for an existing project if you have some script that removes the node_modules
folder as part of a cleanup process (which I do as well)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With