跳到主内容
版本:10.x

功能比较

功能pnpmYarnnpmNotes
Workspace support
隔离的 node_modulesDefault in pnpm.
Hoisted node_modulesDefault in npm.
Plug'n'PlayDefault in Yarn.
Autoinstalling peers
零安装
Patching dependencies
Managing Node.js versions
Managing versions of itself
拥有锁文件pnpm-lock.yaml, yarn.lock, package-lock.json.
Overrides supportKnown as "resolutions" in Yarn.
内容可寻址存储Yarn uses a CAS when nodeLinker is set to pnpm.
Dynamic package executionpnpm dlx, yarn dlx, npx.
Side-effects cache
Catalogs
Config dependencies
JSR registry support
Auto-install before script runIn Yarn, Plug'n'Play ensures dependencies are always up to date.
Hooks
Listing licensespnpm supports it via pnpm licenses list. Yarn has a plugin for it.

Note: To keep the comparison concise, we include only features likely to be used frequently.