Installing pnpm on Ubuntu (Safe Methods)
pnpm and npm coexist safely — nothing breaks, existing node_modules untouched.
Recommended: Corepack (Node.js ≥16.13)
bash
node -v # confirm ≥16.13
corepack enable
corepack prepare pnpm@latest --activate
pnpm -vAlternative: via npm
bash
npm install -g pnpm
pnpm -vAfter install (good practice)
bash
pnpm setup # sets global bin path
source ~/.bashrcAvoid (less controlled)
bash
curl -fsSL https://get.pnpm.io/install.sh | sh - # modifies shell configsNotes
- pnpm uses its own store at
~/.pnpm-store - No impact on global npm packages
- Excellent monorepo support (vs npm's basic support)
- Faster and lower disk usage than npm (uses symlinks)
