I just created a react app, it was working fine but once I restart the editor it is throwing error like this :
Poojas-MacBook-Air:newreact pooja$ npm start
npm ERR! path /Users/pooja/Desktop/projects/newreact/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/Users/pooja/Desktop/projects/newreact/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A plete log of this run can be found in:
npm ERR! /Users/pooja/.npm/_logs/2020-11-28T10_27_42_118Z-debug.log
Please help if anyone knows about it.
I just created a react app, it was working fine but once I restart the editor it is throwing error like this :
Poojas-MacBook-Air:newreact pooja$ npm start
npm ERR! path /Users/pooja/Desktop/projects/newreact/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/Users/pooja/Desktop/projects/newreact/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A plete log of this run can be found in:
npm ERR! /Users/pooja/.npm/_logs/2020-11-28T10_27_42_118Z-debug.log
Please help if anyone knows about it.
Share Improve this question asked Nov 28, 2020 at 10:37 Pooja KushwahPooja Kushwah 1872 gold badges2 silver badges14 bronze badges 3- are you in the file diretry. it is showing package.json is not in the current directry. – sharun k k Commented Nov 28, 2020 at 10:39
- yes in a same directory – Pooja Kushwah Commented Nov 28, 2020 at 10:40
- 1 please share your directry file list in the question. – sharun k k Commented Nov 28, 2020 at 10:42
4 Answers
Reset to default 4- Make sure you have the latest npm (
npm install -g npm
). - Add an exception to your antivirus to ignore the node_modules folder in your project.
rm -rf node_modules package-lock.json
npm install
Sometimes the PATH is not correct, just open the cmd and cd
to the address where the package.json is and then run npm start
For me, it was because of the running Metro server. If anyone is experiencing this issue in react-native
, make sure you have stopped the running Metro server instance before entering npm i <package-name>
.
With yarn
, I think, there's no such issue.
To resolve package.json file, go to your project folder and find package.json location folder. Open terminal and make sure your are in correct path where package.json file located. eg: c://projectfolder/folder1/clientapp> npm start