electron-releases icon indicating copy to clipboard operation
electron-releases copied to clipboard

`Error: EEXIST: file already exists, symlink 'Versions/Current/Electron Framework'` with yarn classic

Open eXhumer opened this issue 1 year ago • 2 comments

I use yarn classic (v1.22.22) as my package manager and I keep receiving Error: EEXIST: file already exists, symlink 'Versions/Current/Electron Framework' -> '/Users/exhumer/Projects/exviewer/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Electron Framework' when I try yarn upgrade or yarn sometimes. If I re-run the same command twice, the problem doesn't appear and finishes the process without any error. It seems like if an existing symlink exist on macOS with the yarn package manager specifically, it fails the install script. The issue doesn't seem to appear if I use the npm package manager instead.

[4/4] 🔨  Rebuilding all packages...
error /Users/exhumer/Projects/exviewer/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /Users/exhumer/Projects/exviewer/node_modules/electron
Output:
Error: EEXIST: file already exists, symlink 'Versions/Current/Electron Framework' -> '/Users/exhumer/Projects/exviewer/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Electron Framework'
    at async Object.symlink (node:internal/fs/promises:1001:10)
    at async Extractor.extractEntry (/Users/exhumer/Projects/exviewer/node_modules/extract-zip/index.js:130:7)
    at async ZipFile.<anonymous> (/Users/exhumer/Projects/exviewer/node_modules/extract-zip/index.js:65:11)
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

Is there any consideration to maybe delete all contents in the distPath before trying to extract files into it? This would prevent this issue from appearing.

https://github.com/castlabs/electron-releases/blob/da9eb56bdcb9093db0c0b0c1a66e8bdb4f0f267e/install.js#L73-L90

eXhumer avatar Sep 17 '24 18:09 eXhumer

Adding fs.rmSync(distPath, { recursive: true, force: true }); before the calling extract method seems to fix the issue.

eXhumer avatar Sep 17 '24 20:09 eXhumer

We are using the same install script as mainline Electron, so I suppose this would be an issue there as well? It looks like classic yarn does not remove the existing install prior to extracting thew new one, and extract-zip doesn't properly overwrite symlinks.

Is this still an issue?

khwaaj avatar Apr 02 '25 06:04 khwaaj

I have stopped using yarn classic as package manager since I opened this issue, so I didn't manage to test it further. I would assume it still to be the case.

eXhumer avatar Jul 11 '25 11:07 eXhumer