pnpm CLI

짧은 별칭#

추가된 버전: v11.0.0

pn은 pnpm의 짧은 별칭으로, pnx는 pnpm dlx의 짧은 별칭으로 사용할 수 있습니다. pnpm 또는 pnpx를 사용하는 모든 곳에서 이를 사용할 수 있습니다:

pn install
pn add express
pn build
pn test
pnx create-vue my-app

npm과의 차이점#

npm과 달리 pnpm은 모든 옵션의 유효성을 검사합니다. 예를 들어, --target_arch는 pnpm install의 유효한 옵션이 아니므로 pnpm install --target_arch x64는 실패합니다.

Some dependencies read an npm_config_ environment variable during their build. pnpm does not set these variables from its options, so set the variable yourself: npm_config_target_arch=x64 pnpm install.

옵션#

-C <path>, --dir <path>#

현재 작업 디렉터리 대신 <path>에서 pnpm이 시작된 것처럼 실행합니다.

-w, --workspace-root#

현재 작업 디렉터리 대신 워크스페이스의 루트에서 pnpm이 시작된 것처럼 실행합니다.

Commands#

자세한 내용은 각각의 CLI commands 문서를 참고하십시오. 다음 목록은 npm 커맨드와의 간단한 비교입니다.

npm pnpm
npm install pnpm install
npm i <pkg> pnpm add <pkg>
npm run <cmd> pnpm <cmd>
npx <pkg> pnx <pkg>

알 수 없는 명령이 사용되면 pnpm은 주어진 이름의 스크립트를 검색하므로, pnpm run lint는 pnpm lint와 같습니다. 지정된 이름의 스크립트가 없으면 pnpm은 명령을 셸 스크립트로 실행하므로, pnpm eslint와 같은 작업을 할 수 있습니다(pnpm exec 참조).

Since v11.28.0, this also works with --filter and --recursive: pnpm -r eslint runs the eslint script in the selected projects that have one, and when none of them has a script by that name, it runs the eslint command installed in their dependencies. pnpm run with --filter or -r still reports the missing script.

환경 변수#

pnpm과 관련되지 않은 일부 환경 변수는 pnpm의 동작을 변경할 수 있습니다.

이러한 환경 변수는 pnpm이 전역 정보를 저장하기 위해 사용하는 디렉토리에 영향을 줄 수 있습니다.

  • XDG_CACHE_HOME
  • XDG_CONFIG_HOME
  • XDG_DATA_HOME
  • XDG_STATE_HOME

You can search the docs to find the settings that use these environment variables.