Whenever I run “npm start” and “yarn start” in order to connect to local host but I get the following errors respectively. I have been using “yarn start” and it has been working, but it stoped working when I restarted my system. I am on windows7. Please what do I do? Thanks.
It expects there to be a package.json file (note with some command for start
defined) in the directory you’re trying to run it in.
When you type that command, npm or yarn is going to look for the package.json file. In the file, it will look for the start
field under scripts
, and run whatever the command defined there is. It doesn’t do anything clever - if that file isn’t there nothing will happen. If you try to run it from a different directory for example, the file won’t be there.
The package.json file is there but the command does not recognize it. Please, is there something I should add to the file? What should I do to solve this issue.
Try yarn cache clean
, something’s broken, most likely the cache in some way. And update yarn/npm as well, that’s important, it’s not resolving paths correctly if you are definitely in the directory where the package.json file lives.
I have tried that it did not work. So I am starting all over again. Thank you for your time and assistance.