pnpm add <package...>

Installs a package and any packages that it depends on. By default, any new package is installed as a production dependency

Arguments

NameDescription
package

Options

NameDescription
--offlineIf true, pnpm will use only packages already available in the store. If a package won't be found locally, the installation will fail
--prefer-offlineIf true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use --offline
--ignore-scriptsDo not execute any scripts defined in the project package.json and its dependencies
--reporter <Reporter Type>Allows you to choose the reporter that will log debug info to the terminal about the installation progress
-P, --save-prodInstall the specified packages as regular dependencies
-D, --save-devInstall the specified packages as devDependencies
-O, --save-optionalInstall the specified packages as optionalDependencies
--no-savePrevents saving to `dependencies`
-E, --save-exactSaved dependencies will be configured with an exact version rather than using pnpm's default semver range operator
--save-peerUsing --save-peer will add one or more packages to peerDependencies and install them as dev dependencies
--ignore-workspace-root-check, -W#Adding a new dependency to the root workspace package fails, unless the --ignore-workspace-root-check or -W flag is used. For instance, pnpm add debug -W
--global, -gInstall a package globally
--workspaceOnly adds the new dependency if it is found in the workspace
--filter <Filepath / Package>Filtering allows you to restrict commands to specific subsets of packages. pnpm supports a rich selector syntax for picking packages by name or by relation. More details: https://pnpm.io/filtering