1

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!

1
  • package.json file should be in the root folder, same where you are typing npm start. Currently it is located in the src folder. Commented Feb 22, 2020 at 22:18

2 Answers 2

1

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!

Sign up to request clarification or add additional context in comments.

2 Comments

it now says npm WARN Local package.json exists, but node_modules missing, did you mean to install?
@RC96 Just extended my answer but yes, as it says you need to install the dependencies first.
0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.