I got the following errors every time I run npm install. How could I solve it?
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:CSclassdidipass/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:CSclassdidipasspackage.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:UsersASUSAppDataLocalnpm-cache_logs2023-02-01T20_19_40_952Z-debug-0.log
I already update to the newest version of npm and I have tried npm cache clear
but it doesn’t work for me.
Thanks for helping me.
2
Answers
Make sure your terminal is in the right directory. Is your project nested in a folder by chance? The folder you are in in the terminal should be the same folder your project is DIRECTLY in.
In other words: make sure you cd into the direct container of your project. If the filetree looks like this:
Make sure you are in
project_1
, and not inmy_projects
.Let me know if this helps.
The error
"npm ERR! code ENOENT syscall open"
occurs when you issue an npm command outside of the root directory of your project. To solve the error, cd into the root directory of your project before issuing the command or generate a new package. json file in the directory.