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] Getting constant EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\90a9a665 when installing packages #3079

Closed
ruluva opened this issue Apr 15, 2021 · 11 comments · Fixed by npm/cacache#59
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@ruluva
Copy link

ruluva commented Apr 15, 2021

Current Behavior:

When trying to install packages, with a previous cache present, we get constant cache collisions when trying to install packages, both locally and in a CI environment.

Stack trace:

2621 verbose stack Error: EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\90a9a665'
2622 verbose cwd D:\a\1\s
2623 verbose Windows_NT 10.0.17763
2624 verbose argv "C:\\hostedtoolcache\\windows\\node\\14.15.4\\x64\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "ci" "--no-audit" "--prefer-offline" "--force"
2625 verbose node v14.15.4
2626 verbose npm  v7.9.0
2627 error code EEXIST
2628 error syscall open
2629 error path C:\npm\cache\_cacache\tmp\90a9a665
2630 error errno -4075
2631 error EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\90a9a665'
2632 error File exists: C:\npm\cache\_cacache\tmp\90a9a665
2633 error Remove the existing file and try again, or run npm
2634 error with --force to overwrite files recklessly.
2635 verbose exit -4075

Expected Behavior:

Be able to resolve cache collisions without failing

Steps To Reproduce:

Using a project with workspaces (~6425 packages)
Previous cache available
Run npm ci

Environment:

OS: Windows 10
Node: 14.15.4
npm: 7.9.0

@ruluva ruluva added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Apr 15, 2021
@ruluva
Copy link
Author

ruluva commented Apr 15, 2021

This is more prevalent after a subsequent install attempt, trying to circumvent issue #3078. Seems to only affect Windows machines.

@ruluva ruluva changed the title [BUG] Getting constant EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\90a9a665' when installing packages [BUG] Getting constant EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\90a9a665 when installing packages Apr 15, 2021
@darcyclarke
Copy link
Contributor

@ruluva can you try an earlier version of v7 & see if you can still replicate this? (ex. npm i -g [email protected]) Also, can you try temporarily cleaning out that cache & regenerate it through a successful install? (idea here would be to determine if this problem arises only with failed installs, and a problem w/ cleaning up the tmp/cache - or see if ci installs don't also run into this problem after successful installs)

Of note, after talking quickly with @nlf he also believes #3078 might be linked to this & is going to help investigate further in both cases.

@darcyclarke darcyclarke added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Apr 15, 2021
@darcyclarke darcyclarke added this to the OSS - Sprint 28 milestone Apr 15, 2021
@ruluva
Copy link
Author

ruluva commented Apr 15, 2021

I gave npm 7.5.0 a shot, and still saw the issue. As far as I was able to tell, it seems to only trigger on failed installs (like the in the case where we get the socket timeout) and try an install again. Another thing to point out is I haven't seen this issue on another Linux (Ubuntu 16.04) build machine we have. Unfortunately, most of our machines as well as dev machines are Windows.

@ruluva
Copy link
Author

ruluva commented Apr 16, 2021

Here is a screenshot I got from a teammate:
MicrosoftTeams-image (1)

Where the log shows the same issue seen above. It sounds like he had a successful install before hand (npm ci), pulled from master and tried to run npm ci again, and got that error. He also tried running npm cache clean --force and still got the same thing. npm i appeared to work for him.

@jivanim
Copy link

jivanim commented Apr 16, 2021

Here is a screenshot I got from a teammate:
MicrosoftTeams-image (1)

Where the log shows the same issue seen above. It sounds like he had a successful install before hand (npm ci), pulled from master and tried to run npm ci again, and got that error. He also tried running npm cache clean --force and still got the same thing. npm i appeared to work for him.

@nlf
Copy link
Contributor

nlf commented Apr 16, 2021

this one sure feels like it's happening because of an otherwise hidden problem in how we handle failures of network requests that's surfacing because of #3078

i'm going to look into this separately, since it is definitely a bug.

@darcyclarke
Copy link
Contributor

@nlf any update here?

@kanoshin
Copy link

kanoshin commented Jun 22, 2021

This issue started happening almost in 100% of runs on our windows build agents after updating to npm v7.18.0. Reverting to v7.17.0 seems to be fixing it.

We've attempted to run npm cache clean --force, manually removing npm caches and also running npm i --force but nothing helped, only version revert did.

@kanoshin
Copy link

kanoshin commented Jul 1, 2021

@nlf @darcyclarke this issue is getting more and more serious as it starts happening on some of our developer machines and above workaround doesn't seem to help all the time. Is there something we can provide to help you diagnose this issue? Logs? We can also debug npm process if you provide us guidance with what to look at.

@nlf
Copy link
Contributor

nlf commented Jul 1, 2021

this one sure took a while, but just today i found a very small and subtle but significant bug that was causing the cb() never called issues in windows. there's a patch for it you can see here: npm/minipass-fetch#14

to allow us to test and see if this is really the root cause of the problems seen here, i've pushed a branch of the npm cli that you can install and test with. you can run npm i -g github:npm/cli#fetch-patch to install it, then use npm normally and let me know what you see! i'm hopeful that fixing this underlying issue will take care of the other problems you're seeing as well.

@kanoshin
Copy link

kanoshin commented Jul 7, 2021

It helped one of our developers after completely reinstalling node and then updating npm with npm i -g github:npm/cli#fetch-patch. Another one is still having this issue, he didn't reinstall node though, just updated npm.

@darcyclarke darcyclarke removed this from the OSS - Sprint 33 milestone Jul 26, 2021
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 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants