PNPM: A Practical Use Case

PNPM: A Practical Use Case


If you are using either npm or yarn to install packages, ditch it and start using pnpm. pnpm will save you disk space as well as installation time. You can read about the motivation behind creating pnpm on their website.


If your Node.js version is >16.13, use Corepack to enable pnpm.

Command equivalents

npm commandpnpm equivalent
npm ipnpm i
npm i <pkg>pnpm add <pkg>
npm run <cmd>pnpm <cmd>
npx <cmd>pnpx <cmd>

Convert npm project to pnpm

Say, you already have a project that consists of node_modules, package.json, package-lock.json and various other files. Now to convert this project to use pnpm, first delete the node_modules folder as well as the package-lock.json file. Do not delete the package.json file.

Now, instead of doing npm i, run the command pnpm i.