Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm start throwing error 'This is related to npm not being able to find a file.'

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 complete 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.

like image 842
Pooja Kushwah Avatar asked Oct 14 '25 17:10

Pooja Kushwah


2 Answers

  1. Make sure you have the latest npm (npm install -g npm).
  2. Add an exception to your antivirus to ignore the node_modules folder in your project.
  3. rm -rf node_modules package-lock.json
  4. npm install
like image 68
Idir Hamouch Avatar answered Oct 19 '25 17:10

Idir Hamouch


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

like image 24
Edylson Frederico Avatar answered Oct 19 '25 17:10

Edylson Frederico