pnpm doctor
설치된 pnpm과 pnpm이 실행되는 환경에 대해 진단을 실행합니다.
pnpm doctor [--offline] [--benchmark] [--json]
각 검사는 발견한 문제의 해결 방법을 알려 주며, 검사 중 하나라도 실패하면 명령은 오류 종료 코드를 반환합니다. 경고는 명령을 실패시키지 않습니다.
✓ Versions: pnpm 12.3.4, Node.js 22.20.0
✓ Install method: pnpm
✓ Node.js on PATH: /Users/example/.local/share/fnm/node-versions/v22.20.0/installation/bin/node
✓ Script shell: scripts run in /bin/sh (/bin/bash), package executables in /bin/sh (/bin/bash)
✓ Global bin directory: /Users/example/Library/pnpm/bin
✓ Cache directory: /Users/example/Library/Caches/pnpm
✓ Store directory: /Users/example/Library/pnpm/store/v11
✓ Filesystem: available: reflink, hardlink, symlink
✓ Registry connectivity: https://registry.npmjs.org/ (128ms)
✓ Install smoke test: offline "file:" install linked its dependency
✓ Lifecycle scripts: an install script ran /Users/example/.local/share/fnm/node-versions/v22.20.0/installation/bin/node, a script in /Users/example/my-project ran /Users/example/.local/share/fnm/node-versions/v22.20.0/installation/bin/node
All checks passed
검사 항목#
버전#
실행 중인 pnpm과 Node.js 버전을 보고합니다.
설치 방법#
Reports pnpm as the install method and warns when pnpm is being run by Corepack, which manages the pnpm version itself and makes pnpm self-update unavailable.
It also warns when the pnpm found on PATH is not the one in the global bin directory. This happens when a copy from another installer, such as npm, Homebrew, Volta, or Scoop, comes first on PATH. The warning names that copy. If pnpm recognizes the installer, it gives the command that removes the copy. Otherwise it gives the PATH change that puts the global bin directory first.
Node.js on PATH#
Added in: v12.23.0
Lists the node executables on the PATH pnpm runs with, in lookup order. Lifecycle scripts run the first one, unless a directory pnpm puts ahead of them, such as node_modules/.bin, has its own node. pnpm itself does not need Node.js, but the executables in node_modules/.bin that run JavaScript do.
Warns when there is no node on PATH, and when a node entry is skipped because it is a broken link, not executable, or not a file. A version manager that relinks node while scripts run can leave such an entry behind.
Script shell#
Added in: v12.23.0
Reports the shell that runs scripts: the scriptShell, the built-in shell emulator, or sh. Outside Windows it also reports what /bin/sh is, because /bin/sh starts every executable in node_modules/.bin. On macOS that is the shell /private/var/select/sh links to.
Fails when the shell that runs scripts is not found.
전역 bin 디렉터리#
전역 실행 파일을 pnpm이 링크하는 디렉터리가 PATH에 있고 쓰기 가능한지 확인합니다. PATH에 없는 경우 pnpm setup을 실행하여 해결할 수 있습니다.
캐시 디렉터리#
캐시 디렉터리가 쓰기 가능한지 확인합니다.
스토어 디렉터리#
스토어 디렉터리가 쓰기 가능한지 확인합니다. When no store directory is configured, the check runs against the default store.
파일 시스템#
Probes which link strategies work between the store and the project: reflink (copy-on-write), hardlink, and symlink. This is what determines how packages land in node_modules and how fast an install is. A reflink or hardlink is near-free, a plain copy is not.
설치 시 reflink와 hardlink가 모두 작동하지 않으면 복사 방식으로 대체된다고 경고하며, 스토어를 프로젝트와 같은 파일 시스템에 두라고 제안합니다.
레지스트리 연결#
구성된 레지스트리에 15초 제한 시간으로 ping을 보내고 왕복 시간을 보고합니다. 레지스트리에 연결할 수 없거나 오류 상태로 응답하면 실패하며, 이는 보통 네트워크, 프록시 또는 인증 구성 문제를 의미합니다.
--offline 사용 시 건너뜁니다.
설치 스모크 테스트#
임시 디렉터리에서 완전히 오프라인으로 일회용 패키지를 file: 종속성으로 설치합니다. 이는 resolve, 스토어, 링크 경로를 처음부터 끝까지 실행하며 실행 중인 바이너리가 실제로 설치를 수행할 수 있음을 확인합니다.
이 검사는 구조상 항상 오프라인으로 수행되므로 --offline으로 건너뛰지 않습니다.
Lifecycle scripts#
Added in: v12.23.0
Installs a temporary project whose postinstall script calls a dependency's executable, using the configured script shell. It then runs the same executable through pnpm exec in the current project, if there is one. Both go through the executable's node_modules/.bin shim, which has to find node on PATH. The check reports the node each run used.
If a run fails, the report includes the error and, outside Windows, the end of an sh -x trace of the shim. The trace shows the PATH the shim searched and the command it ran. A shim that finds no node is the usual cause of a script failing with exit status 127.
The run in the current project goes through pnpm exec, so the project's pnpmfile and nodeOptions apply to it as they do to pnpm exec. So do the settings passed to pnpm doctor on the command line. It does not install the project's dependencies. With --offline, it runs offline too. The whole check is skipped when there is no node on PATH.
옵션#
--offline#
네트워크 접근이 필요한 검사를 건너뜁니다.
--benchmark#
Also time the filesystem, install, and lifecycle script checks, reporting the duration alongside each result.
--json#
결과를 JSON으로 보고합니다. 출력은 단일 checks 배열을 가진 객체이며, 각 항목에는 title, status (pass, warn 또는 fail)와 선택적으로 detail, fix, durationMs가 포함됩니다.
{
"checks": [
{
"title": "Filesystem",
"status": "pass",
"detail": "available: reflink, hardlink, symlink",
"durationMs": 3
}
]
}