Pnpm
lastmod 2026-11-16created 2023-03-143 edits
빠르고, 효율적인 패키지 매니저
Features
- Fast. Up to 2x faster than the alternatives (see benchmark).
- Efficient. Files inside node_modules are linked from a single content-addressable storage.
- Great for monorepos.
- Strict. A package can access only dependencies that are specified in its package.json.
- Deterministic. Has a lockfile called pnpm-lock.yaml.
- Works as a Node.js version manager. See pnpm env use.
- Works everywhere. Supports Windows, Linux, and macOS.
- Battle-tested. Used in production by teams of all sizes since 2016.
- See the full feature comparison with npm and Yarn.
npm vs yarn vs yarn-berry vs pnpm
Case 01
- Yarn 대신 pnpm으로 넘어간 3가지 이유 | GeekNews
- [원문] Yarn 대신 pnpm으로 넘어간 3가지 이유
- Airbridge 가 Yarn Berry 에서 pnpm 으로 옮기고 1년 동안 써 본 후기 (2023년 3월)
- Yarn PnP 는 패키지를
.yarn/cache에 zip 으로 커밋하므로, 커밋이 1만 건을 넘는 저장소에서 바이너리 패키지가 Git 기록에 계속 쌓이는 것이 부담이었음. nodeLinker 모드로 바꾸자 Yarn Berry 를 쓸 이유가 없어짐 - 호이스팅 때문에 설치하지 않은 패키지(예:
prop-types)를 import 해도 동작하는 ghost dependency 가 프로덕션 장애로 이어짐. pnpm 은 전역 저장소의 패키지를package.json에 적힌 것만 symlink 로 연결해 이를 막음 - Yarn Workspace 는
--cwd를 늘 지정해야 하는 버그 등이 있었음. pnpm 은pnpm-workspace.yml에 폴더를 적으면 패키지끼리 자동으로 링크됨 - 전환 후 배포 중 패키지 설치 시간이 Yarn 대비 30초~1분 줄었고,
pnpm env use --global lts로 Node 버전도 관리함 - npm 도 v9.4 부터 pnpm 방식의 isolated node_modules 를 지원하기 시작함
See also
Favorite site
이 문서를 가리키는 문서