RC96
RC96

Reputation: 13

React Application npm start is giving an error

I am trying to run my React app in the local environment and keep getting the following error

PS  npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Documents\business-website-react-master\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\\Documents\business-website-react-master\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\_logs\2020-02-22T20_12_59_502Z-debug.log

Here is what the folder directory looks like as well.

screenshot

the package.json file is still there so i don't understand why the file cannot be located.

Thank you in advance!

Upvotes: 1

Views: 768

Answers (2)

Angie
Angie

Reputation: 1

I kept getting the npm err when I was trying to download react for the first time. I tried all the things that were suggested here and was only able to get 2 different json folders on seperate occasions. That was it the package-lock.json as well as just package.json. Grandpa always said, "Go to the root of the problem." Then I went back to node.js. I chose the repair option. While that was running, I was still reading options and saw someone suggested npm install -g npm. The repair had completed as I was starting to type that in. So not sure which was the fix. I wanted to share the repair on node.js because I didn't see anyone else suggesting that... Hope this helps!

Upvotes: 0

norbitrial
norbitrial

Reputation: 15166

As the error message states, npm does not find package.json file. The reason in your case is that the file is located in the src folder. Once you move the file into the root - where you tried to run earlier - and run npm start then it should be just starting fine.

If the node_modules folder is also missing - which is containing all the installed dependencies to run your project - then you need to run first npm install which will take all the dependencies from package.json and install them.

I hope that helps!

Upvotes: 1

Related Questions