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] EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\e21a7cda' in GitHub Actions CI inconsistently when running under Windows #7308

Open
2 tasks done
vladfrangu opened this issue Mar 21, 2024 · 4 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x

Comments

@vladfrangu
Copy link

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 ci on a Windows runner on GH Actions (via the provided runners), npm inconsistently consistently throws EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\e21a7cda' errors when trying to run npm ci (and even when using --force.

Here's an example run log: https://github.com/apify/apify-cli/actions/runs/8378040031/job/22941626321?pr=527

What I mean by inconsistently consistently is that it works randomly, then it stops working, then it works again. I'm not sure what else to do at this point to make this not work or why it's having issues. In the PR attached to the above run, I tried turning off the cache configuration from setup-node, but that had no effect.

This hasn't happened once on ubuntu, which makes me think there might be a Windows-specific issue. What's even stranger is that the cache directory is actually empty, yet these issues happen,

Expected Behavior

npm shouldn't encounter caching issues on Windows, and should have some form of retry mechanisms for these issues.

Steps To Reproduce

  1. Setup an action workflow that runs on windows on github actions
  2. Try to install dependencies with npm ci

You might need a few runs of the flow to see it happening, which is not ideal either.

Example flow:

name: Check & Release

on:
    push:

jobs:
    build_and_test:
        name: Build & Test
        runs-on: ${{ matrix.os }}

        strategy:
            fail-fast: false
            matrix:
                os: [ubuntu-latest, windows-latest]
                node-version: [18, 20]

        steps:
            - uses: actions/checkout@v4

            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v4
              with:
                  node-version: ${{ matrix.node-version }}
                  cache: ${{ (matrix.os != 'windows-latest' && 'npm') || '' }}

            # I considered this bug might've been fixed in newer npm versions, but that wasn't the case :cry:
            # - name: Bump npm to latest
            #   if: matrix.os == 'windows-latest'
            #   run: npm install -g npm@latest

            - name: Install Dependencies
              run: npm ci ${{ (matrix.os == 'windows-latest' && '--force') || '' }}

Environment

  • npm: 10.2.4 & 10.5.0
  • Node.js: v18.19.1
  • OS Name: Microsoft Windows Server 2022 10.0.20348 Datacenter
  • System Model Name: no clue, whatever GH Actions runs on 😅
  • npm config:
; "global" config from C:\npm\prefix\etc\npmrc

cache = "C:\\npm\\cache" 

; "env" config from environment

prefix = "C:\\npm\\prefix" 

; node bin location = C:\hostedtoolcache\windows\node\18.19.1\x64\node.exe
; node version = v18.19.1
; npm local prefix = D:\a\apify-cli\apify-cli
; npm version = 10.5.0
; cwd = D:\a\apify-cli\apify-cli
; HOME = C:\Users\runneradmin
; Run `npm config ls -l` to show all defaults.
@das7pad
Copy link

das7pad commented Apr 25, 2024

We are facing this on npm ci in a fresh node:18.20.2 Docker container running in Google Cloud Build (no caching configured).

$ npm ci
...
npm ERR! code EEXIST
npm ERR! syscall open
npm ERR! path /builder/home/.npm/_cacache/tmp/da69041f
npm ERR! errno -17
npm ERR! EEXIST: file already exists, open '/builder/home/.npm/_cacache/tmp/da69041f'
npm ERR! File exists: /builder/home/.npm/_cacache/tmp/da69041f
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
# cloudbuild.yaml
steps:
  - name: "node:18.20.2"
    script: |
      #!/usr/bin/env bash
      npm ci

@vladfrangu
Copy link
Author

I'm also going to upload the logs here in case the GitHub actions logs expire:

logs_21970753725.zip

@shaykr
Copy link

shaykr commented Apr 29, 2024

We have the same issue today

@perfilev-faraway
Copy link

Try to use node v22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x
Projects
None yet
Development

No branches or pull requests

4 participants