pnpm
pnpm
A fast, disk-efficient Node.js package manager. Uses hard links.
pnpm
A fast, disk-efficient Node.js package manager. Uses hard links.
pnpm (performant npm) is, along with npm and Yarn, one of the major package managers in the Node.js ecosystem. Its most notable feature is a distinctive storage method that uses hard links and symbolic links, which dramatically saves disk space.
pnpm stores a package only once in a global store, and each project links to it with hard links. For example, even if 10 projects use the same version of lodash, it is actually downloaded only once. This is especially effective in large monorepos.
In addition, pnpm uses a strict node_modules structure. A package can access only its own dependencies, which prevents the phantom dependencies problem. This prevents you from accidentally using a package that is not declared in package.json.
Installation is also fast. Thanks to a content-addressable store and parallel installation, installs can be up to 2 times faster or more than npm. It also has a built-in workspace feature, so it is optimized for monorepo management.
# pnpm 설치
npm install -g pnpm
# 프로젝트 의존성 설치
pnpm install
# 패키지 추가
pnpm add express
pnpm add -D typescript # devDependencies로 추가
# 워크스페이스에서 특정 패키지에 설치
pnpm add lodash --filter @myorg/api
# 스크립트 실행
pnpm run build
pnpm test
# 모든 워크스페이스에서 명령 실행
pnpm -r run build # recursive
# 패키지 업데이트
pnpm update
pnpm update --interactive # 대화형 업데이트
# 불필요한 패키지 정리
pnpm prune
# 저장소 크기 확인
pnpm store status
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free