add Verified current stable Not installed? Package Management

Add / Download Package As Dev Dependency

Download Package As Dev Dependency

Installs a package as a development dependency.

$
Terminal
pnpm add <module_name> -D

When To Use

During project setup for new features requiring additional dev libraries.

Pro Tip

Use `--no-cache` for fresh installs in CI environments to avoid stale dependencies.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
pnpm add <module_name> -D

Anatomy of Output

Understanding the result

+ example-package@1.0.0 Package

Indicates successful installation of the package.

added 1 package, and audited 50 packages in 200ms Stats

Shows total packages added and scanned for vulnerabilities.

found 0 vulnerabilities Vulnerabilities

Verdict on current package security.

Troubleshooting

Common pitfalls

ERR_PNPM_NO_PACKAGE: The package 'example-package' is not found

Solution: Ensure package name is correct.

ERR_PNPM_ADDING_TO_ROOT: Cannot add to a root package, please specify a working directory

Solution: Run this command from within a package directory.

ERR_PNPM_LOCKFILE_MISMATCH: Lockfile is out of sync with package.json

Solution: Run `pnpm install` to refresh lockfile.

Command Breakdown

What each part is doing

pnpm
Base Command
The executable that performs this operation. Here it runs Add before the shell applies any redirect operators.
<module_name>
module name
The value supplied for module name.
-D
D| save dev
The value supplied for D| save dev.
-D
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.