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

Symlinks gone in MacOS Electron.app

Open shmulka opened this issue 2 years ago • 8 comments

Beginning with Electron 21, it seems that all symlinks are gone from Darwin Electron.app in the Castlabs releases.

This results in our code signing failing with bundle format unrecognized, when pointing to folders which used to include symlinks.

See below electron/electron compared to castlabs/electron framework directories (release 22.1.0) node_modules/electron/dist/Electron.app/Contents/Frameworks

22_1_0

shmulka avatar Jan 31 '23 15:01 shmulka

Ah, this again. We have had an issue around this previously, but the problem isn't actually in the ECS package (if you download and extract the zip manually you should find the symlinks are actually there). That time it only happened for a few packages, and then started working again (without us changing anything), so the culprit was never properly identified.

The actual issues is, unfortunately, rather elusive. IIRC something in the combination of extract-zip/yauzl, which is used to extract the zip when installing Electron, causes a silent abortion for some zip files - leaving the installation incomplete. I also seem to remember successfully trying yauzl directly, using the same zip files outside of the installation context, which makes it even more strange.

Anyway, that was some context. I'll see if I can do some further investigation to maybe find some workaround, at least.

khwaaj avatar Jan 31 '23 17:01 khwaaj

Thanks @khwaaj for all the context :> Manually copying over Electron.app from a downloaded zip could provide a temporary fix. I tested with version 21.4.0 and all symlinks are there. Would be great if you can further investigate, hopefully to find some solution.

shmulka avatar Feb 01 '23 10:02 shmulka

No real solution yet, but it gets weirder. If I go into node_modules/electron after installing I can remove the dist directory and manually run node install.js, to get a proper install with symlinks and all. This is the same script that npm runs, so there is something in that execution context that affects zip extraction... 🤔

Update: Even running npm run postinstall instead of install.js works fine, the only time it fails is during the project wide install.

khwaaj avatar Feb 02 '23 14:02 khwaaj

Using yarn instead of npm also works, so that may be a workaround if you don't mind changing.

khwaaj avatar Feb 02 '23 19:02 khwaaj

Thanks @khwaaj, i'll stick to NPM and use the postinstall option. It works and keeps the build process automated which is a definite improvement :tada: .

shmulka avatar Feb 05 '23 11:02 shmulka

Is there an intention to fix this with npm?

saenzramiro avatar Mar 10 '23 13:03 saenzramiro

We have spent some time investigating this, but the reason npm fails on some archives is elusive. It may be related to the caching mechanism employed by npm, but there appears to be no way to disable it to verify that theory. The fact that the npm run postinstall and yarn workarounds are viable suggests something in the npm install/update process is at fault, so maybe reporting this as an issue to npm-project could be worthwhile.

The intention is absolutely to get this fixed somehow, but as there are workarounds available other things have been taking precedence for now.

khwaaj avatar Mar 10 '23 14:03 khwaaj

I'm using an i9 mac. so I downloaded electron-v24.1.2+wvcus-darwin-x64.zip and replaced the existing Frameworks and Resources folders in my node_modules electron.app. Maybe I should have replaced it altogether. npm starts now renders the mainWindow BUT stops with:

./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Emit

Error: Failed to initialize Angular compilation - NGCC failed.

arcovoltaico avatar Jul 30 '24 12:07 arcovoltaico