LOGGING(7)
π
LOGGING(7) β bestie, let's talk about the Logging manual page
Okay so this is the LOGGING(7) page, and it's literally the why, what & how of how we log stuff. Buckle up. π
β¨ NAME β¨
Logging β Why, What & How we Log. That's it, that's the vibe. π¦
πΈ Description πΈ
The npm CLI has, like, various mechanisms for showing different levels of information back to end-users β for certain commands, configurations & environments. Not me explaining the whole personality of npm logging in one sentence but here we are. π
π Setting Log File Location π
So all logs get written to a debug log, and the path to that file gets printed if the execution of a command fails. Convenient? Extremely. π«Ά
The default location of the logs directory is a directory named _logs inside the npm cache. Lowkey iconic default. You can change it with the logs-dir config option.
For example, if you wanted to write all your logs to the current working directory, you could run:
npm install --logs-dir=.
This is especially helpful in debugging a specific npm issue, because you can run a command multiple times with different config values and then diff all the log files. Detective mode: activated. πβ¨
Log files will be removed from the logs-dir when the number of log files exceeds logs-max, with the oldest logs being deleted first. Bye bestie, you're expired. π
To turn off logs completely set --logs-max=0. No logs, no notes. Silence. π€«
π¦ Setting Log Levels π¦
π loglevel
loglevel is a global argument/config that can be set to determine the type of information to be displayed. Main character setting, honestly.
The default value of loglevel is "notice" but there are several levels/types of logs available, including:
"silent""error""warn""notice""http""info""verbose""silly"
All logs pertaining to a level preceding the current setting will be shown. So it's like a cumulative vibe check β everything above your level comes along for the ride. β
π Aliases
The log levels listed above have various corresponding aliases, including:
-d:--loglevel info--dd:--loglevel verbose--verbose:--loglevel verbose--ddd:--loglevel silly-q:--loglevel warn--quiet:--loglevel warn-s:--loglevel silent--silent:--loglevel silent
Same energy, shorter typing. You're welcome. π
π foreground-scripts
The npm CLI began hiding the output of lifecycle scripts for npm install as of v7. Notably β and this is the part that gets people β this means you will not see logs/output from packages that may be using "install scripts" to display information back to you, or from your own project's scripts defined in package.json. π
If you'd like to change this behavior & log this output you can set foreground-scripts to true. Problem solved, bestie. π«Ά
β±οΈ Timing Information β±οΈ
The --timing config β¨/using-npm/config#timingβ© can be set, which does a few things:
- Always shows the full path to the debug log regardless of command exit status
- Write timing information to a process specific timing file in the cache or
logs-dir - Output timing information to the terminal
This file contains a timers object where the keys are an identifier for the portion of the process being timed and the value is the number of milliseconds it took to complete. Numbers! Data! Gorgeous. π₯
Sometimes it is helpful to get timing information without outputting anything to the terminal. For example, the performance might be affected by writing to the terminal. In this case you can use --timing --silent which will still write the timing file, but not output anything to the terminal while running. Stealth mode timing, no cap. π§
π Registry Response Headers π
π npm-notice
The npm CLI reads from & logs any npm-notice headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur. Cute little note-passing system, honestly. π
This header is not cached, and will not be logged if the request is served from the cache. Important. Don't forget it. π
π₯ Logs and Sensitive Information π₯
The npm CLI makes a best effort to redact the following from terminal output and log files:
- Passwords inside basic auth URLs
- npm tokens
However β and this is the big one β this behavior should not be relied on to keep all possible sensitive information redacted. Best effort is best effort, not a guarantee, bestie. π
If you are concerned about secrets in your log file or terminal output, you can use --loglevel=silent and --logs-max=0 to ensure no logs are written to your terminal or filesystem. Locked down, sealed, gorgeous. πβ¨
β See also β
npm help config
That's the whole page, mwah π β and yes, this is NPM@11.17.0, dated June 2026, so you're reading the freshest version. Slay, go forth and log responsibly. ππ¦π
π¦ where this page comes from
- centos-stream 10: nodejs24-npm 1:11.17.0-1.24.19.0.1.el10 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms