I am working on a React project and noticed issues when trying to run npm start to view my project on the local host. It says that I am missing the script start, but that is not true. I checked my package.json file and it is definitely there. I ran the run/debug in my package.json and it launched to the local host just fine. However, if I run npm start in my iTerm it still gives the same error. Any advice/insight is much appreciated
here is the error in my iTerm
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in: /Users/cassiusreynolds/.npm/_logs/2023-06-28T21_40_58_049Z-debug-0.log
Not sure if it’s true but some people are suggesting that using the old globally installed create-react-app might cause the error. If so you might need to remove it and create a new app.
Or you can try to remove the globally installed create-react-app and just update the project.
Both have the potential to introduce breaking changes so test it on a backup of the project first.
I’m pretty sure if you run npm start in a folder without a package.json file you will get some error about “no such file or directory”. I think you only get the Missing script error if it actually finds a package.json file. But I guess it is possible you are in the wrong folder but it has a package.json file.
thank you for the reply. I did not notice until ArielLeslie pointed it out, but I actually forgot to cd into my react app after creating it bc the other folder had a very similar name. So, I was never in the root of the project. Thank you for the warning against installing globally!