pnpm add <pkg>
Installs a package and any packages that it depends on. By default, any new package is installed as a production dependency.
TL;DR
Command | Meaning |
---|---|
pnpm add sax | Save to dependencies |
pnpm add -D sax | Save to devDependencies |
pnpm add -O sax | Save to optionalDependencies |
pnpm add -g sax | Install package globally |
pnpm add sax@next | Install from the next tag |
pnpm add sax@3.0.0 | Specify version 3.0.0 |
Supported package locations
Install from npm registry
pnpm add package-name
will install the latest version of package-name
from
the npm registry by default.
If executed in a workspace, the command will first try to check whether other projects in the workspace use the specified package. If so, the already used version range will be installed.
You may also install packages by:
- tag:
pnpm add express@nightly
- version:
pnpm add express@1.0.0
- version range:
pnpm add express@2 react@">=0.1.0 <0.2.0"