npm Verified current stable Not installed? Package Management

Npm / Output Changes As Json

Output Changes As Json

Use npm prune --json to get the results of the prune operation in JSON format for automation.

$
Terminal
npm prune --json

When To Use

Integrate npm prune results into automated workflows using JSON format.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
{"removed":["package1","package2"],"added":[],"updated":[]}

Command Breakdown

What each part is doing

npm
Base Command
The executable that performs this operation. Here it runs Npm before the shell applies any redirect operators.
--json
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Open your terminal.

  2. Step 2

    Run the command: npm prune --json.

  3. Step 3

    Capture the JSON output for further processing.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.