'How to get pnpm store directory
Is there any way how to check directory/path of pnpm store?
I know you can set it with npm config set store /path/to/.pnpm-store, but npm config get store in my case returns undefined, which I guess means to pnpm to use some default, but where can I find this default value?
Solution 1:[1]
Nowadays you can do
pnpm store path
which, according to pnpm's documentation:
Returns the path to the active store directory.
Solution 2:[2]
previously, pnpm store is located on user home folder.
Linux : ~/.pnpm-store
Windows : C:\Users\YOUR_NAME\.pnpm-store
macOS : ~/.pnpm-store
but from now on (v7.0.0), pnpm store is located on different folder. it will located on $XDG_DATA_HOME on Linux, and %LOCALAPPDATA% on Windows. take a look to this issue.
Linux : ~/.local/share/pnpm/store (default)
Windows : C:\Users\YOUR_NAME\AppData\Local\pnpm\store
macOS : ~/Library/pnpm/store
or, you can check where is located with pnpm store path command
Solution 3:[3]
Possible locaiton:
~/.pnpm-store
If project is on the same partition as user home.$partition_root/.pnpm-store
If project is on different partition as user home.
Why not just use ~/.pnpm-store:
- On linux/mac, pnpm use hard link to reuse file.
- And hard link, can be created only on the same partition.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | renardesque |
| Solution 2 | nouvist |
| Solution 3 | Eric |
