pnpm

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
pnpm is a fast, disk space efficient package manager. It uses a content-addressable store to deduplicate packages across all projects on a machine, saving significant disk space. pnpm enforces strict dependency resolution by default, preventing phantom dependencies. Configuration should preferably be placed in
pnpm-workspace.yaml
for pnpm-specific settings.
Important: When working with pnpm projects, agents should check for
pnpm-workspace.yaml
and
.npmrc
files to understand workspace structure and configuration. Always use
--frozen-lockfile
in CI environments.
The skill is based on pnpm 10.x, generated at 2026-01-28.
pnpm是一款快速、磁盘空间高效的包管理器。它使用内容可寻址存储来在一台机器上的所有项目中重复数据删除包,节省大量磁盘空间。pnpm默认强制严格的依赖解析,防止幽灵依赖。配置最好放在
pnpm-workspace.yaml
中以设置pnpm专属的配置项。
重要提示: 处理pnpm项目时,Agent应检查
pnpm-workspace.yaml
.npmrc
文件以了解工作区结构和配置。在CI环境中始终使用
--frozen-lockfile
参数。
本Skill基于pnpm 10.x版本生成,生成时间为2026-01-28。

Core

核心功能

TopicDescriptionReference
CLI CommandsInstall, add, remove, update, run, exec, dlx, and workspace commandscore-cli
Configurationpnpm-workspace.yaml, .npmrc settings, and package.json fieldscore-config
WorkspacesMonorepo support with filtering, workspace protocol, and shared lockfilecore-workspaces
StoreContent-addressable storage, hard links, and disk efficiencycore-store
主题描述参考
CLI命令安装、添加、移除、更新、运行、执行、dlx和工作区命令core-cli
配置pnpm-workspace.yaml、.npmrc设置和package.json字段core-config
工作区支持单体仓库(Monorepo),包含过滤、工作区协议和共享锁文件core-workspaces
存储内容可寻址存储、硬链接和磁盘效率core-store

Features

扩展功能

TopicDescriptionReference
CatalogsCentralized dependency version management for workspacesfeatures-catalogs
OverridesForce specific versions of dependencies including transitivefeatures-overrides
PatchesModify third-party packages with custom fixesfeatures-patches
AliasesInstall packages under custom names using npm: protocolfeatures-aliases
HooksCustomize resolution with .pnpmfile.cjs hooksfeatures-hooks
Peer DependenciesAuto-install, strict mode, and dependency rulesfeatures-peer-deps
主题描述参考
目录(Catalogs)为工作区提供集中式依赖版本管理features-catalogs
覆盖(Overrides)强制指定依赖的特定版本,包括传递依赖features-overrides
补丁(Patches)使用自定义修复修改第三方包features-patches
别名(Aliases)使用npm:协议以自定义名称安装包features-aliases
钩子(Hooks)使用.pnpmfile.cjs钩子自定义解析逻辑features-hooks
对等依赖(Peer Dependencies)自动安装、严格模式和依赖规则features-peer-deps

Best Practices

最佳实践

TopicDescriptionReference
CI/CD SetupGitHub Actions, GitLab CI, Docker, and caching strategiesbest-practices-ci
MigrationMigrating from npm/Yarn, handling phantom deps, monorepo migrationbest-practices-migration
PerformanceInstall optimizations, store caching, workspace parallelizationbest-practices-performance
主题描述参考
CI/CD设置GitHub Actions、GitLab CI、Docker和缓存策略best-practices-ci
迁移从npm/Yarn迁移、处理幽灵依赖、单体仓库迁移best-practices-migration
性能安装优化、存储缓存、工作区并行化best-practices-performance