← 返回命令列表

Linux command

pnpm 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Install dependencies

pnpm install

Add a package

pnpm add [package]

Add dev dependency

pnpm add -D [package]

Run script

pnpm run [script]

Update packages

pnpm update

Remove package

pnpm remove [package]

说明

pnpm is a fast, disk-efficient package manager for Node.js that uses a content-addressable storage system. Instead of copying packages into each project's node_modules, pnpm creates hard links from a single global store, dramatically reducing disk usage when multiple projects share the same dependencies. It provides a strict node_modules structure that prevents accessing undeclared dependencies, improving project reliability. The CLI is largely compatible with npm, supporting install, add, remove, update, and run commands with similar syntax. Workspace support via -r (recursive) enables managing monorepo projects.

参数

install
Install all dependencies.
add _PACKAGE_
Add a package.
-D, --save-dev
Save as dev dependency.
remove _PACKAGE_
Remove a package.
update
Update packages.
run _SCRIPT_
Run a script.
exec _CMD_
Execute a command.
-r, --recursive
Run in all workspaces.

FAQ

What is the pnpm command used for?

pnpm is a fast, disk-efficient package manager for Node.js that uses a content-addressable storage system. Instead of copying packages into each project's node_modules, pnpm creates hard links from a single global store, dramatically reducing disk usage when multiple projects share the same dependencies. It provides a strict node_modules structure that prevents accessing undeclared dependencies, improving project reliability. The CLI is largely compatible with npm, supporting install, add, remove, update, and run commands with similar syntax. Workspace support via -r (recursive) enables managing monorepo projects.

How do I run a basic pnpm example?

Run `pnpm install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does install do in pnpm?

Install all dependencies.