-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release
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 with logs_max=0 npm still attempts to run the log cleanup routine. This routine attempts to scandir. If this is happening in CI where npm is being invoked as root this causes a permission error and warning to be output for every npm run command:
[2023-03-10T19:21:39.786Z] npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
[2023-03-10T19:21:39.786Z] npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
[2023-03-10T19:21:39.786Z] npm WARN logfile errno: -13,
[2023-03-10T19:21:39.786Z] npm WARN logfile code: 'EACCES',
[2023-03-10T19:21:39.786Z] npm WARN logfile syscall: 'scandir',
[2023-03-10T19:21:39.786Z] npm WARN logfile path: '/root/.npm/_logs'
[2023-03-10T19:21:39.786Z] npm WARN logfile }
What's odd though, is if the directory is non-existent, no warning is printed.
Expected Behavior
The cleanup routine not to run when logs_max=0.
To not have warnings for every npm run command in CI :)
Steps To Reproduce
- Using official Node docker images
- Running as a user that doesn't have permission to write to the logs directory (try running as the root user)
- Run any npm run command with
logs-max=0in the .npmrc orNPM_CONFIG_LOGS_MAX=on the env - The cleanup routine will still attempt to run and will print a warning
Environment
- npm: 8.19.2
- Node.js: v18.12.1
- OS Name: MacOS
- System Model Name: MacBook Pro (14-inch, 2021) [Apple M1 Pro]
- npm config:
always-auth = false
engine-strict = true
logs-max = 0Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release