Build failing with EEXIST: file already exists

See original GitHub issue

20.26.0 ( latest )

MacOS - DMG , Windows - Squirrel ( Windows build passes, MacOS build fails)

I’m having the same issue as was brought up here https://github.com/electron-userland/electron-builder/issues/3039 , The MacOS build fails with EEXIST: file already exists, below is a sample of the error, there are more similar errors in the error log. This only happens on the CI (Bitrise) , if I run the build on a local machine it works perfectly, this also only seems to affect MacOS, Windows local & CI builds work perfectly.

 electron-builder version=20.26.0
  • artifacts will be published reason=tag is defined tag=0.33.0-pre3
  • loaded configuration file=package.json ("build" field)
  • skipped app dependencies rebuild reason=npmRebuild is set to false
  • packaging       platform=darwin arch=x64 electron=2.0.5 appOutDir=dist/mac
  • downloading               parts=4 size=49 MB url=https://github.com/electron/electron/releases/download/v2.0.5/electron-v2.0.5-darwin-x64.zip
  • downloading               parts=1 size=5.3 kB url=https://github.com/electron/electron/releases/download/v2.0.5/SHASUMS256.txt
  • asar using is disabled — it is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
Error: Cannot cleanup: 
Error #1 --------------------------------------------------------------------------------
Error: EEXIST: file already exists, link '/Users/vagrant/git/node_modules/electron-remote/node_modules/debug/LICENSE' -> '/Users/vagrant/git/client/dist/mac/Electron.app/Contents/Resources/app/node_modules/debug/LICENSE'
    at copyOrLinkFile (/Users/vagrant/git/node_modules/builder-util/src/fs.ts:182:12)
    at /Users/vagrant/git/node_modules/builder-util/src/fs.ts:257:11
    at Generator.next (<anonymous>)
From previous event:
    at FileCopier.copy (/Users/vagrant/git/node_modules/builder-util/src/fs.ts:235:64)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/util/appFileCopier.ts:70:13
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/vagrant/git/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/vagrant/git/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:154:5)
From previous event:
    at copyAppFiles (/Users/vagrant/git/node_modules/app-builder-lib/out/util/appFileCopier.js:260:17)
    at taskManager.addTask._bluebirdLst.default.each.it (/Users/vagrant/git/node_modules/app-builder-lib/src/platformPackager.ts:292:86)
From previous event:
    at MacPackager.copyAppFiles (/Users/vagrant/git/node_modules/app-builder-lib/src/platformPackager.ts:292:43)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/platformPackager.ts:209:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
From previous event:
    at MacPackager.doPack (/Users/vagrant/git/node_modules/app-builder-lib/src/platformPackager.ts:157:165)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/macPackager.ts:88:63
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/Users/vagrant/git/node_modules/app-builder-lib/src/macPackager.ts:80:95)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:376:24
    at Generator.next (<anonymous>)
    at xfs.mkdir.er (/Users/vagrant/git/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:37:14)
    at FSReqWrap.oncomplete (fs.js:136:15)
From previous event:
    at Packager.doBuild (/Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:344:39)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:314:57
From previous event:
    at Packager._build (/Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:285:133)
    at /Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:281:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
From previous event:
    at Packager.build (/Users/vagrant/git/node_modules/app-builder-lib/src/packager.ts:238:14)
    at build (/Users/vagrant/git/node_modules/app-builder-lib/src/index.ts:58:28)
    at build (/Users/vagrant/git/node_modules/electron-builder/src/builder.ts:227:10)
    at then (/Users/vagrant/git/node_modules/electron-builder/src/cli/cli.ts:42:48)
    at <anonymous>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
develarcommented, Jul 27, 2018

Set env USE_HARD_LINKS=false as workaround.

4reactions
vraravamcommented, May 23, 2021

Set env USE_HARD_LINKS=false as workaround.

Finally, this seems to have fixed the problem. I’m recording my comment here in case it helps others in newer builds of electron-builder - v22.10.5. Builds on both xenial (ubuntu) and osx (xcode 12.4) were failing till I set this env variable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm error on every command: EEXIST: file already exists ...
I'm just new to node and npm and this is frustrating. Well it's almost all said in the title. On a Windows 10...
Read more >
Error: EEXIST: file already exists when output directory ...
Error: EEXIST: file already exists when output directory already exists # ... directory if it already exists, instead of trying to create it....
Read more >
Yarn install fails with 'EEXIST: file already exists, symlink ...'
Hi community, during setup my first VSF-Next project, I am facing the problem that a yarn install ist not working after the initial...
Read more >
After manually delete a file, and use FileOutputStream to ...
Every time user download file, I will check if file already exists, if so, delete it, and create new one: file = new...
Read more >
Safely creating new directories using the Node.js File System ...
If the /path/to/new/directory directory already exists, this will fail with the following error: Error: EEXIST: file already exists, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found