pnpm shim <cmd>

추가된 버전: v12.0.0-rc.6 (pnpm v12 전용)

프로젝트 인식 명령 shim을 관리합니다.

이 명령으로 생성된 shim은 전역 설치를 기반으로 하지 않습니다. 이 shim은 현재 위치한 프로젝트가 무엇을 실행할지 결정하도록 하기 위해서만 존재합니다: pnpm shim add yarn은 현재 프로젝트가 고정한 버전을 실행하는 yarn 명령을 링크하고, 해당 버전을 필요할 때 프로비저닝합니다. 머신에 pnpm만 설치되어 있는 경우, 이것이 Yarn 프로젝트 내에서 yarn이 동작하도록 해 줍니다.

Creating a shim is always deliberate. Nothing writes one as a side effect of pnpm setup or an install, because a shim shadows whatever the rest of your PATH resolved before it.

Commands#

add#

pnpm shim add <pkg>...

각 패키지의 모든 bin에 대한 shim을 전역 bin 디렉터리(pnpm bin -g)에 링크하고, shim이 실제로 디스패치되도록 globalShims 설정에 패키지를 기록합니다.

pnpm shim add yarn

The package managers pnpm provisions (npm, yarn, bun) need no lookup: their bins are known up front, aliases included (yarn and yarnpkg, npm and npx). Since v12.11.0, pnpm shim add rust adds shims for the tools of a Rust toolchain: cargo, cargo-clippy, cargo-fmt, clippy-driver, rustc, rustdoc, and rustfmt. 그 외의 패키지의 경우 패키지의 게시된 매니페스트에서 bin을 읽습니다; bin을 게시하지 않은 패키지는 ERR_PNPM_SHIM_NO_BINS 오류로 실패합니다.

A bin that is already in the global bin directory belongs to something else (a globally installed package, or another package's shim), so the command refuses with ERR_PNPM_SHIM_BIN_CONFLICT rather than taking a working command away.

globalShims: false가 설정된 상태에서 shim을 추가하면 ERR_PNPM_SHIMS_DISABLED 오류로 실패합니다: 이 설정은 모든 프로젝트 인식 shim을 끄므로, shim이 PATH에 있어도 아무 동작도 하지 않기 때문입니다.

Without a package, the command fails with ERR_PNPM_SHIM_NO_PACKAGE. If no global bin directory is configured, it fails with ERR_PNPM_NO_GLOBAL_BIN_DIR. Run pnpm setup to create one. pnpm shim without a subcommand fails with ERR_PNPM_SHIM_NO_SUBCOMMAND.

rm#

pnpm shim rm <pkg>...

별칭: remove, uninstall

패키지의 shim과 add가 해당 패키지에 대해 기록한 globalShims 항목을 제거합니다.

ls#

pnpm shim ls

별칭: list

전역 bin 디렉터리의 모든 shim을 해당 shim에 적용되는 정책과 함께 나열합니다:

yarn (auto): yarn, yarnpkg

버전 선택 방식#

현재 작업 디렉터리에서 위로 올라가며 shim이 현재 위치한 프로젝트를 확인합니다:

  • 패키지 관리자의 경우 프로젝트의 packageManager 또는 devEngines.packageManager 고정 값이 버전을 결정하고, pnpm이 해당 버전을 프로비저닝합니다. 고정 값은 프로젝트를 무엇으로 설치할지 프로젝트가 직접 명시한 것이므로, 전역으로 설치된 해당 패키지 관리자보다 우선합니다.
  • For the Rust tools, the nearest rust-toolchain.toml (or rust-toolchain) decides the toolchain, read the way rustup reads it. pnpm installs that toolchain into the store on first use and runs the tool with the toolchain's bin directory first on PATH. It also sets RUSTUP_TOOLCHAIN to the toolchain, so a rustup proxy that Cargo runs, such as cargo-clippy in ~/.cargo/bin, runs the same toolchain. A toolchain is a release the Rust project signed, so it runs without the confirmation prompt. Where no toolchain file applies, the toolchain pnpm add -g rust installed runs, and without one the next command of the same name on PATH, such as rustup's. Where the nearest toolchain file is one pnpm leaves to rustup, the next command on PATH runs. So does a command that picks its toolchain the rustup way: a +<toolchain> argument, RUSTUP_TOOLCHAIN, or a rustup override set directory override at or below the toolchain file. A Rust shim switched off, through globalShims or PNPM_SHIM_BYPASS, also runs the next command on PATH.
  • 그 밖의 패키지의 경우 프로젝트의 node_modules/.bin/<name>이 사용됩니다.

If nothing in the project provides the command, the globally installed version runs. A shim never makes a command fail merely because dispatch did not apply.

프로젝트 인식 전역 bin의 신뢰 규칙이 여기에도 적용됩니다: npm에 게시된 패키지 관리자는 정확한 버전에 대한 npm 서명으로 검증되어 묻지 않고 전환되는 반면, Bun과 Yarn 6은 체크섬이 고정된 플랫폼 아카이브로 제공되어 확인 프롬프트를 거칩니다. 이 응답은 프로젝트별 그리고 바이너리별로 기억되므로, 프로젝트의 고정 버전을 다른 버전으로 변경하면 다시 묻습니다.

The shim is a real executable#

Since v12.3.0, every project-aware global command pnpm writes is a native executable on every platform: the shims pnpm shim add creates, and the node, deno, and bun commands. On Windows that means <name>.exe instead of the .cmd and .ps1 pair earlier pnpm 12 releases wrote.

The practical difference is that a shell no longer sits between you and the command, so environment variables whose names are not valid shell identifiers survive the hop. Shims written by an earlier pnpm 12 are replaced on the next global install or pnpm self-update.

관련 항목#