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

Build failing with EEXIST: file already exists #3179

Closed
smithalan92 opened this issue Jul 27, 2018 · 12 comments
Closed

Build failing with EEXIST: file already exists #3179

smithalan92 opened this issue Jul 27, 2018 · 12 comments

Comments

@smithalan92
Copy link

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 #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>
@develar
Copy link
Member

develar commented Jul 27, 2018

Set env USE_HARD_LINKS=false as workaround.

@develar
Copy link
Member

develar commented Jul 27, 2018

Is it possible to provide project or sample to reproduce (locally you can reproduce using env USE_HARD_LINKS=true)?

@smithalan92
Copy link
Author

Thanks for the reply @develar , Setting the env variable works 👍

I can't provide the project, its on a private repo, but I've made a quick sample app using the same dependencies as the app that has the problem

https://github.com/smithalan92/electron-builder-sample-error-app

npm i in the root and in ./src and then npm run build and the error will happen

just-jeb pushed a commit to just-jeb/electron-angular-native that referenced this issue Jul 27, 2018
just-jeb pushed a commit to just-jeb/electron-angular-native that referenced this issue Jul 27, 2018
cheton added a commit to cncjs/cncjs that referenced this issue Jul 29, 2018
* Set env `USE_HARD_LINKS=false` to workaround electron-builder errors (electron-userland/electron-builder#3179)

* Do not update github releases when a build failed

* Increase no activity timeout to 40 mins for Docker build

* Remove rpm from target package types

* Update github releases for the master branch only
ficristo added a commit to quadre-code/quadre that referenced this issue Dec 15, 2018
Make sure electron-rebuild pick a more up do date version of node-abi for electron >= 2 compatibility.
Set env USE_HARD_LINKS=false as workaround. See electron-userland/electron-builder#3179
Changed linux package (libopenjp2-tools wasn't found). See https://github.com/electron-userland/electron-builder/releases/tag/v20.0.4
ficristo added a commit to quadre-code/quadre that referenced this issue Dec 15, 2018
Make sure electron-rebuild pick a more up do date version of node-abi for electron >= 2 compatibility.
Set env USE_HARD_LINKS=false as workaround. See electron-userland/electron-builder#3179
Changed linux package (libopenjp2-tools wasn't found). See https://github.com/electron-userland/electron-builder/releases/tag/v20.0.4
ficristo added a commit to quadre-code/quadre that referenced this issue Dec 15, 2018
Make sure electron-rebuild pick a more up do date version of node-abi for electron >= 2 compatibility.
Set env USE_HARD_LINKS=false as workaround. See electron-userland/electron-builder#3179
Changed linux package (libopenjp2-tools wasn't found). See https://github.com/electron-userland/electron-builder/releases/tag/v20.0.4
@snene
Copy link

snene commented Jun 4, 2019

@smithalan92 @develar Where do you set the USE_HARD_LINKS env variable? I am also facing the same issue with electron-builder 20.43.0 while building on mac

For now I created a file named electron-builder.env and put it in there.

@smithalan92
Copy link
Author

@snene For Windows it needs to be set in System Environment Variables, for MacOS it needs to go in your ~/.bashrc or ~/.bash_profile file ( see here

@snene
Copy link

snene commented Jun 4, 2019

Thanks a bunch for the prompt reply @smithalan92

@stale
Copy link

stale bot commented Aug 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@vraravam
Copy link

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.

@MikeJerred
Copy link
Contributor

Just ran into this issue on v22.13.1. USE_HARD_LINKS=false fixes it

@nwittwer
Copy link

Just ran into this issue on v22.13.1. USE_HARD_LINKS=false fixes it

USE_HARD_LINKS=false fixes the issue in v22.14.13 as well. Using Github Actions as CI.

Is there a long-term fix for this planned?

@ggreco
Copy link

ggreco commented Mar 8, 2022

Also happens (electron-builder 22.14.13) using a CUSTOM github actions runner, while I can build without errors on the same machine if I run electron-builder not through the github runner.

I can confirm that adding USE_HARD_LINKS: false to the environment of the step that package the application solves the issue.

I tested this in an environment where the output was an universal binary DMG.

@itsPG
Copy link

itsPG commented Nov 10, 2023

I ran into this issue while I was building code on a macOS jenkins node.

electron-builder version: 24.6.3

Currently the source code of builder-util/src/fs.ts is const _isUseHardLink = process.platform !== "win32" && process.env.USE_HARD_LINKS !== "false" && (isCI || process.env.USE_HARD_LINKS === "true")

thus electron-builder will enable _isUseHardLink on jenkins automatically, whereas it didn't work on my macOS jenkins node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants