nwhy command
Author: himynameisdaveCreated Sep 17, 2026Updated Sep 17, 2026
Labelsenhancement
Clear and concise description of the problem
Might as well read this guy first: https://github.com/antfu-collective/package-manager-detector/issues/78
ni and the commands it provides are great because no matter what package manager, the command just works and everyone is happy.
One command I love is the why so you can figure out how a transitive dependency is being pulled in. So why no nwhy?
Suggested solution
nwhy will call out to yarn why or bun why or whichever package manager happens to be in use in that project.
Alternative
Alternative is that I am just gonna build a one-off tool for this, but like that sucks. So many people already use this great package.
Additional context
Most package managers support this command in some way deno not included. all package managers sold separately.
| Agent | Command | Docs |
|---|---|---|
| npm | npm explain (npm why alias) |
https://docs.npmjs.com/cli/v11/commands/npm-explain/ |
| yarn (v1) | yarn why |
https://classic.yarnpkg.com/lang/en/docs/cli/why/ |
| yarn (berry) | yarn why |
https://yarnpkg.com/cli/why |
| pnpm | pnpm why |
https://pnpm.io/cli/why |
| bun | bun why |
https://bun.com/docs/pm/cli/why |
| aube | aube why |
https://aube.sh/cli/why.html |
| nub | nub why |
https://nubjs.com/docs/install (no dedicated page; why is in the info-verb set dispatched to the aube engine, see https://github.com/nubjs/nub/pull/40) |
| deno | — | no equivalent |
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Source: antfu-collective/ni