Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected warning on each operation #4128

Closed
2 tasks done
zdm opened this issue Dec 6, 2021 · 2 comments
Closed
2 tasks done

[BUG] Unexpected warning on each operation #4128

zdm opened this issue Dec 6, 2021 · 2 comments
Assignees
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@zdm
Copy link

zdm commented Dec 6, 2021

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

  1. I have webpack-dev-server running in the other console.
  2. When I am trying to exec any npm command, for example npm update I am getting warnings:
npm WARN logfile Error: EPERM: operation not permitted, unlink 'C:\Users\zdm\.npm-cache\_logs\2021-12-05T06_01_16_787Z-debug-0.log'
npm WARN logfile  error removing log file C:/Users/zdm/.npm-cache/_logs/2021-12-05T06_01_16_787Z-debug-0.log [Error: EPERM: operation not permitted, unlink 'C:\Users\zdm\.npm-cache\_logs\2021-12-05T06_01_16_787Z-debug-0.log'] {
npm WARN logfile   errno: -4048,
npm WARN logfile   code: 'EPERM',
npm WARN logfile   syscall: 'unlink',
npm WARN logfile   path: 'C:\\Users\\zdm\\.npm-cache\\_logs\\2021-12-05T06_01_16_787Z-debug-0.log'
npm WARN logfile }
  1. If I close webpack - mentioned log file become unlocked and warnings are not shown.
  2. This issue introduced in npm v8.2.0;

Expected Behavior

Don't want to see this warnings.

Steps To Reproduce

Described above

Environment

  • npm: 8.2.0
  • Node: 17.2.0
  • OS: windows 11
  • platform: -
  • npm config: no npm config
@zdm zdm added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Dec 6, 2021
@nlf nlf added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Dec 6, 2021
lukekarrys added a commit that referenced this issue Dec 7, 2021
Closes: #4128

This also refactors the logic for cleaning log files to use the `ignore`
option from `glob` to not clean current log files instead of relying on
updating the `logs-max` count.

I also discovered a bug where we weren't cleaning log files written with
the old naming convention, so this fixes that as well.
@lukekarrys
Copy link
Contributor

Thanks for the report @zdm! This was due to our new debug log behavior which opens a file descriptor for the debug log at the beginning of the process. We also attempt to clean out old log files, so what ended up happening was we were attempting to close a currently open file which causes that error on Windows. This is actually ok, so the change was just to not bubble up that error to the warn loglevel and instead drop it to the silly level.

This change should go out on Thursday, but let me know if you see any other weird behavior before that.

@zdm
Copy link
Author

zdm commented Dec 7, 2021

The problem is that this warnings are mixed with the command output and prevents to read it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

3 participants