pnpm why

지정된 패키지에 의존하는 모든 패키지를 표시합니다.

pnpm why <pkg>...

예시:

pnpm why "@babel/*"

A package name or --find-by is required. Without either, the command fails with ERR_PNPM_MISSING_PACKAGE_NAME.

출력은 역방향 종속성 트리입니다: 검색한 패키지가 루트에 표시되고, 이 패키지에 의존하는 패키지들이 가지로 표시되며 워크스페이스 루트까지 거슬러 올라갑니다.

중복된 하위 트리는 출력에서 중복 제거되어 "deduped"로 표시됩니다.

옵션#

--recursive, -r#

하위 디렉터리의 모든 패키지 또는 워크스페이스 내에서 실행할 경우 모든 워크스페이스 패키지에 대해 지정된 패키지의 종속성 트리를 표시합니다.

--json#

JSON 형식으로 정보를 표시합니다. Dependent nodes include a requires field containing the declared dependency specifier, when available.

--long#

자세한 출력을 표시합니다.

--parseable#

트리 보기 대신 파싱 가능한 출력을 표시합니다.

--global, -g#

Inspect packages in the global install directory instead of in the current project.

--ranges#

Show the version range that each direct dependent declares for the package, in place of the tree. Dependents that declare the same range are listed under it, and each installed version gets its own section:

esbuild
  Installed: 0.28.1
  Wanted:
    ^0.28.0:
      vite@6.1.0
    ~0.28.0:
      tsx@4.23.1

A dependent whose package.json cannot be read is listed under <unknown>.

--prod, -P, --production#

Only display the dependency tree for packages in dependencies and optionalDependencies.

--dev, -D#

devDependencies에 있는 패키지의 종속성 트리만 표시합니다.

--no-optional#

optionalDependencies의 패키지를 표시하지 않습니다.

--optional#

Include packages from optionalDependencies.

--depth <number>#

특정 깊이 내의 종속성만 표시합니다.

--exclude-peers#

Leave out the packages that are reached only as a resolved peer dependency. A package that is also a regular dependency of some project or package stays.

--filter <package_selector>#

필터링에 대해 자세히 알아보세요.

--find-by <finder_name>#

.pnpmfile.mjs에 정의된 finder function을 사용하여 이름 이외의 속성으로 종속성을 찾습니다.