npm vs pnpm
People think pnpm is just a faster npm, and there is more to it. npm puts a full copy of each package in every project. pnpm keeps one copy of each version on the disk and links each project to it. pnpm is also strict, so code may only use the packages it listed.
npm
The tool for getting JavaScript packages. It is also the big shelf they come from.
npm is the package tool for JavaScript, and it comes with Node.js. It is also the name of the online registry where JavaScript packages are shared. It holds millions of packages, more than any other registry. The npm install command fetches packages. A file named package.json lists what a project needs. npm can also run a project's scripts, like npm test.
pnpm
A tool that adds packages to JavaScript apps. It keeps one copy of each on your disk.
pnpm is a free package manager for JavaScript that saves disk space. It keeps each version of a package only once, in one store on your computer. Each project then links to the files in that store. It does not copy them. So ten projects that use the same package share one copy. It installs from the same npm registry as npm and Yarn.
In one line
- npm
- The tool for getting JavaScript packages. It is also the big shelf they come from.
- pnpm
- A tool that adds packages to JavaScript apps. It keeps one copy of each on your disk.