Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm pack --json in the latest npm version (10.5.0) emits prepare script commands and thus making the output invalid json.
This is a breaking change from previous npm version, which broke our deploy workflows.

Expected Behavior
npm pack --json should always output valid json, as it was in the previous versions.

Steps To Reproduce
Create a package which includes a prepare script.
Run npm pack --json
Environment
- npm:
- Node.js:
- OS Name:
- System Model Name:
- npm config:
; copy and paste output from `npm config ls` here
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm pack --jsonin the latest npm version (10.5.0) emits prepare script commands and thus making the output invalid json.This is a breaking change from previous npm version, which broke our deploy workflows.
Expected Behavior
npm pack --jsonshould always output valid json, as it was in the previous versions.Steps To Reproduce
Create a package which includes a prepare script.
Run
npm pack --jsonEnvironment
; copy and paste output from `npm config ls` here