How do I determine why a particular package is installed? In other words, what package(s) depend on this package?
The package in question is babelify. npm ls
shows it at the top level, but it is not included in package.json anywhere.
Run the npm list command in your terminal to see what local packages and their dependencies you have installed. Use the npm list command and package name to see whether a package is installed locally or not.
To check for all globally installed packages and its dependencies, run the npm list command followed by the -g flag. This above command prints the all globally installed packages in tree view. You can also check if a specific package is installed globally or not using the npm list -g followed by package name.
Local Installation of Packages: Local packages are installed in the directory where you run npm install <package-name> and they are put in the node_modules folder under this directory.
Use npm ls
to list installed packages and see the dependency graph of a given package eg:
> npm ls core-js my_module /path/to/my_module> └─┬ [email protected] └─┬ [email protected] └─┬ [email protected] └─┬ [email protected] └─┬ [email protected] └── [email protected]
As you mention, npm ls
shows packages and their dependencies:
> npm ls leveldown [email protected] C:\Users\mikem\Code\appless `-- @architect/[email protected] `-- [email protected] `-- UNMET OPTIONAL DEPENDENCY [email protected]
If npm ls
shows it at the top level, and it is not a dependency in the top level package.json
, it's likely was previously required and is now no longer used.
Use npm prune
to remove the unused package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With