-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
📝 Provide detailed reproduction steps (if any)
When the files field in rootPackageJson contains nested paths or overlapping glob patterns, the prepareRepository() task may fail with the EEXIST error.
This occurs because multiple asynchronous fs.cp() calls attempt to create the same intermediate directories or copy to overlapping destinations concurrently.
-
Set
rootPackageJson.filesto include multiple nested globs, e.g.:{ "files": ["src/**/*", "src/**/index.js"] } -
Run the
prepareRepository()function. -
From time to time, the
EEXISTerror occurs.
✔️ Expected result
All files matched by the files patterns should be copied to the output directory without race conditions or unexpected filesystem errors.
❌ Actual result
The operation sometimes fails with EEXIST errors on random files, depending on filesystem timing and concurrency.
📃 Other details
Calling
fsPromises.mkdir()whenpathis a directory that exists results in a rejection only whenrecursiveis false.
https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesmkdirpath-options