- Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
config:displayIssues dealing with display of data to terminalIssues dealing with display of data to terminalsemver:majorbackwards-incompatible breaking changesbackwards-incompatible breaking changes
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When running npm install
with json
and silent
options the result are inconsistent.
json
+ silent
options when the package does not exist removes the logs such as npm ERR! code E404
+ prints the JSON as expected 👍
npm install --json --silent shouldnotexistforthatexample { "error": { "code": "E404", "summary": "Not Found - GET https://registry.npmjs.org/shouldnotexistforthatexample - Not found", "detail": "\n 'shouldnotexistforthatexample@*' is not in this registry.\n\nNote that you can also install from a\ntarball, folder, http url, or git url." } }
json
options when the package exists prints the JSON as expected 👍
npm install --json chalk { "added": 0, "removed": 0, "changed": 0, "audited": 954, "funding": 186, "audit": { "vulnerabilities": { "info": 0, "low": 0, "moderate": 1, "high": 1, "critical": 0, "total": 2 }, "dependencies": { "prod": 199, "dev": 751, "optional": 5, "peer": 48, "peerOptional": 0, "total": 953 } } }
json
+ silent
options when the package exists removes the JSON 👎
$ npm install --json --silent chalk # no output
Expected Behavior
npm install --silent --json <existingPackage>
should silent the log and leave the json result.
Steps To Reproduce
Default config
Environment
- npm:
8.9.0
- Node.js:
v18.1.0
- OS Name:
21.4.0 Darwin Kernel Version 21.4.0 RELEASE_ARM64_T6000 arm64
- System Model Name: MacBook Pro (14-inch, 2021)
- npm config:
; "user" config from /Users/arnauddebec/.npmrc //registry.npmjs.org/:_authToken = (protected) ; node bin location = /Users/arnauddebec/.nvm/versions/node/v18.1.0/bin/node ; node version = v18.1.0 ; npm local prefix = /Users/arnauddebec/Dev/nacre-test/importhellonacre/node_modules/chalk ; npm version = 8.9.0 ; cwd = /Users/arnauddebec/Dev/nacre-test/importhellonacre/node_modules/chalk ; HOME = /Users/arnauddebec ; Run `npm config ls -l` to show all defaults.
Metadata
Metadata
Assignees
Labels
config:displayIssues dealing with display of data to terminalIssues dealing with display of data to terminalsemver:majorbackwards-incompatible breaking changesbackwards-incompatible breaking changes