What is the store in pnpm?
The store in pnpm is the centralized storage (cache) where pnpm keeps the single copies of every downloaded package. This store lives outside node_modules and is used by every project on the machine.
What the store does
- Stores downloaded dependency versions
- one version of a package lives in the store only once, even if it is used in a hundred projects.
- Is used as the source for
node_modules
- during install, pnpm does not copy packages into the project, it creates hard links to the files in the store.
- Speeds up repeat installs
- if a package is already in the store, pnpm does not download it again.
Where it is stored
Usually in a directory like:
javascript
~/.pnpm-storeThe exact location can be found with:
bash
pnpm store pathWhy this matters
| Capability | What it gives |
|---|---|
| A single store | disk space savings |
| Hard links | faster installation |
| No duplicates | clean, lightweight node_modules |
Summary
The store in pnpm is a global package cache from which pnpm distributes dependencies to every project, using hard links instead of copying. This is the foundation of pnpm's performance and space savings.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.