audit Verified current stable Not installed? Package Management

Audit / Audit Production Dependencies Only

Audit Production Dependencies Only

Performs a security audit exclusively on production dependencies in a PNPM project.

$
Terminal
pnpm audit -P

When To Use

When preparing a release to ensure only essential dependencies are secure.

Pro Tip

Running this command with `--json` can facilitate easier integration with automated testing and reporting systems.

Anatomy of Output

Understanding the result

{"advisories":[{"module":"express","severity":"critical"}],"metadata":{}} Audit Result Summary

Highlights findings within production dependencies.

"module":"express" Critical Vulnerability

Identifies a specific production dependency with known vulnerabilities.

Troubleshooting

Common pitfalls

Error: No production dependencies defined in package.json.

Solution: Check your package.json to ensure production dependencies are listed.

Error: Audit process exceeded timeout threshold.

Solution: Consider adjusting your timeout settings.

Error: Unexpected token in JSON response.

Solution: Ensure the command is executed without unexpected syntax.

Command Breakdown

What each part is doing

pnpm
Base Command
The executable that performs this operation. Here it runs Audit before the shell applies any redirect operators.
-P
P| prod
The value supplied for P| prod.
-P
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.