ENOENT
Like many of the other Exxxxx
errors you'll see while using npm, this is thrown by Node.js:
ENOENT
(No such file or directory): Commonly raised byfs
operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
This comes along with a description of which entity was expected but not found. Specifically, you'll most likely see:
$ npm <something>
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path path/to/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open 'path/to/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
In this case you have tried to run an npm command but no corresponding package file could be found. Most likely one of two things has happened:
- You intended to run a global command (e.g. to install a package for global use or interact with your global npm configuration) but forgot to set the appropriate flag (
--global
/-g
or--location=global
/-L=global
); or - You intended to run a package-level command but are not inside the correct directory.
In the former case you can simply add the relevant flag; in the latter case, check your pwd
and cd
into the appropriate directory before re-running the command.