menu

Questions & Answers

How to resolve the error while running react project?

I am getting an error while trying to run the react project using npm start. I have tried to reinstall npm modules and check but it is not working. It gives error as below:

npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:\Users\91720\Desktop\React js/package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\91720\Desktop\React js\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:\Users\91720\AppData\Local\npm-cache_logs\2021-08-30T14_01_45_332Z-debug.log

Comments:
2023-01-25 00:25:03
Does C:\Users\91720\Desktop\React js\package.json exist?
2023-01-25 00:25:03
Hi @darshini try with this command - composer init
Answers(2) :

Follow the steps below, if you've deleted your package.json file in your project.

  1. Create a react application again using npx create-react-app {app-name} in a different folder. Then move to that folder (cd {app-name}) and check whether package.json file does exist.

  2. Copy all the files you've created previously into /src folder of the newly created app.

  3. If you already have the dependencies you used in previously created app, then copy it in dependency section of package.json file of newly created app.

  4. Run npm install in application directory.

  5. Check whether npm modules are created again.

  6. If it installed perfectly, then run npm start to check whether application starts.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\91720\AppData\Local\npm-cache_logs\2021-08-30T14_01_45_332Z-debug.log

This error is because you are not in current directory TYPE cd{app-name} Then npm start