pnpm Package Manager

pnpm Package Manager

github.com

3

About this website

pnpm is a free and open-source fast, disk space-efficient package manager for JavaScript and Node.js that addresses the performance and storage limitations of npm and Yarn. Created by Zoltan Kochan (zkochan) in 2016 and written in TypeScript, pnpm is the third major package manager for the Node.js ecosystem, alongside npm and Yarn. Key features: content-addressable storage: pnpm stores all packages in a single global store (typically ~/.pnpm-store), using content-addressable hashing to deduplicate packages. If two projects depend on the same version of a package, the package is stored only once on disk, saving significant space (typically 50-80% less than npm). Symlinked node_modules: instead of copying packages into each project's node_modules directory, pnpm creates symlinks from the project to the global store. This also means that adding a dependency that is already in the store is nearly instantaneous. Strict node_modules structure: pnpm creates a non-flat node_modules structure where only direct dependencies are accessible. This prevents accidental access to transitive (indirect) dependencies that are not listed in package.json, eliminating phantom dependencies and ensuring reproducibility. Workspaces: built-in monorepo support via workspaces, allowing multiple packages in a single repository to share dependencies, with hoisting options for compatibility. Performance: pnpm is consistently faster than npm and Yarn in install benchmarks, often 2-3x faster, due to parallel downloads, content-addressable storage, and efficient linking. Lockfile: a deterministic pnpm-lock.yaml file ensures reproducible installs across environments. Peer dependency resolution: pnpm's strict approach surfaces peer dependency issues that npm silently resolves, preventing runtime errors. Hooks: lifecycle scripts (preinstall, postinstall) with security controls. Node.js version management: pnpm env use can install and switch Node.js versions. Cross-platform. MIT.

Tags & Categories

Tags

Statistics

3
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!