NPM-EXPLAIN(1)
π NAME π
npm-explain β Explain installed packages
okay so this is the NPM-EXPLAIN(1) manual page, bestie β welcome to the dependency-receipts zone. π
π Synopsis π
npm explain <package-spec>
alias: why
β¨ DESCRIPTION β¨
Okay so this command will print the chain of dependencies causing a given package to be installed in the current project β literally the receipts, bestie. π₯
If one or more package specs are provided, then only packages matching one of the specifiers will have their relationships explained.
The package spec can also refer to a folder within ./node_modules.
For example, running npm explain glob within npm's source tree will show:
glob@7.1.6
node_modules/glob
glob@"^7.1.4" from the root project
glob@7.1.1 dev
node_modules/tacks/node_modules/glob
glob@"^7.0.5" from rimraf@2.6.2
node_modules/tacks/node_modules/rimraf
rimraf@"^2.6.2" from tacks@1.3.0
node_modules/tacks
dev tacks@"^1.3.0" from the root project
To explain just the package residing at a specific folder, pass that as the argument to the command. This can be useful when trying to figure out exactly why a given dependency is being duplicated to satisfy conflicting version requirements within the project.
$ npm explain node_modules/nyc/node_modules/find-up
find-up@3.0.0 dev
node_modules/nyc/node_modules/find-up
find-up@"^3.0.0" from nyc@14.1.1
node_modules/nyc
nyc@"^14.1.1" from tap@14.10.8
node_modules/tap
dev tap@"^14.10.8" from the root project
βοΈ CONFIGURATION βοΈ
π json π
- Default:
false - Type:
Boolean
Whether or not to output JSON data, rather than the normal output.
- In
npm pkg setit enables parsing set values withJSON.parse()before saving them to yourpackage.json.
Not supported by all npm commands. π
π workspace π
- Default:
- Type: String (can be set multiple times)
Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. π
Valid values for the workspace config are either:
- Workspace names
- Path to a workspace directory
- Path to a parent workspace directory (will result in selecting all workspaces within that folder)
When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
This value is not exported to the environment for child processes.
π SEE ALSO π
npm help "package spec"npm help confignpm help npmrcnpm help foldersnpm help lsnpm help installnpm help linknpm help prunenpm help outdatednpm help update
okay bestie, that's the whole page π this manual is from NPM@12.2.1, dated October 2026 β now go explain some packages, periodt. π«Ά
π¦ where this page comes from
- arch rolling: npm 12.2.1-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms