cli
cli copied to clipboard
[BUG] EEXIST: file already exists, open 'C:\npm\cache\_cacache\tmp\e21a7cda' in GitHub Actions CI inconsistently when running under Windows
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] 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
- Setup an action workflow that runs on windows on github actions
- 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.
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
We have the same issue today
Try to use node v22
also getting this today. Any workarounds?
I found that using npm v9 would be a workaround.
- if: runner.os == 'Windows'
run: npm install -g [email protected]
shell: bash
same issue with ubuntu, node version: "20.12.1"
facing same issue when deploying in heroku docker node app
Similar issue with building inside of docker in a CI/CD system using gitlab