Closed Amstergo closed 6 months ago
Same problem here. Pretty much the vanilla config from the vite typescript template
I am encountering this as well. Usually for semver/bin/semver.js
or which/bin/which
. I have the same error as OP when I use yarn as a package manager, with npm it's different but fails on the same package:
An unhandled rejection has occurred inside Forge:
Error: /var/folders/1d/nq17plrd0psgslq4n1n5gy_40000gn/T/electron-packager/tmp-MQcYl5/Electron.app/Contents/Resources/app/node_modules/@electron/get/node_modules/.bin/semver: file "../../../../../../../../../../../../var/folders/1d/nq17plrd0psgslq4n1n5gy_40000gn/T/electron-packager/tmp-MQcYl5/Electron.app/Contents/Resources/app/node_modules/@electron/get/node_modules/semver/bin/semver.js" links out of the package
at Filesystem.insertLink (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/filesystem.js:106:13)
at handleFile (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:132:20)
at next (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:148:11)
at next (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:149:12)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MacApp.asarApp (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:245:5)
at async MacApp.buildApp (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:150:5)
at async MacApp.initialize (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:141:7)
at async MacApp.create (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/mac.ts:435:5)
at async Promise.all (index 0)
at async packager (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/packager.ts:246:20)
I am encountering this as well. Usually for
semver/bin/semver.js
orwhich/bin/which
. I have the same error as OP when I use yarn as a package manager, with npm it's different but fails on the same package:An unhandled rejection has occurred inside Forge: Error: /var/folders/1d/nq17plrd0psgslq4n1n5gy_40000gn/T/electron-packager/tmp-MQcYl5/Electron.app/Contents/Resources/app/node_modules/@electron/get/node_modules/.bin/semver: file "../../../../../../../../../../../../var/folders/1d/nq17plrd0psgslq4n1n5gy_40000gn/T/electron-packager/tmp-MQcYl5/Electron.app/Contents/Resources/app/node_modules/@electron/get/node_modules/semver/bin/semver.js" links out of the package at Filesystem.insertLink (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/filesystem.js:106:13) at handleFile (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:132:20) at next (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:148:11) at next (/Users/antonia/projects/other/my-app/node_modules/@electron/asar/lib/asar.js:149:12) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async MacApp.asarApp (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:245:5) at async MacApp.buildApp (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:150:5) at async MacApp.initialize (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/platform.ts:141:7) at async MacApp.create (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/mac.ts:435:5) at async Promise.all (index 0) at async packager (/Users/antonia/projects/other/my-app/node_modules/@electron/packager/src/packager.ts:246:20)
Encountered the same issue here. I'm using a pretty standard configuration from the Vite TypeScript template. The problem arose when I added the dependency "@electron-forge/publisher-github": "^7.3.1". I'm running on macOS 14.1.2 (23B92).
Same, using npm
as my package installer
An unhandled rejection has occurred inside Forge:
Error:
/var/folders/ck/jkwcs10946xf1cgp754gh96m0000gn/T/electron-packager/tmp-ONUw7C/Electron.app/Contents/Resources/app/node_modules/conf/node_modules/.bin/semver:
file
"../../../../../../../../../../../../var/folders/ck/jkwcs10946xf1cgp754gh96m0000gn/T/electron-packager/tmp-ONUw7C/Electron.app/Contents/Resources/app/node_modules/conf/node_modules/semver/bin/semver.js"
links out of the package
This just work for me, but i don`t know why.
const config: ForgeConfig = {
packagerConfig: {
- asar: true,
+ asar: false,
icon: './assets/icons/icon',
extraResource: ["./drizzle"],
executableName: 'dash-player',
name: 'DashPlayer',
},
.....
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
- [FuseV1Options.EnableNodeCliInspectArguments]: false,
+ [FuseV1Options.EnableNodeCliInspectArguments]: true,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
- [FuseV1Options.OnlyLoadAppFromAsar]: true,
+ [FuseV1Options.OnlyLoadAppFromAsar]: false,
}),
This just work for me, but i don`t know why.
const config: ForgeConfig = { packagerConfig: { - asar: true, + asar: false, icon: './assets/icons/icon', extraResource: ["./drizzle"], executableName: 'dash-player', name: 'DashPlayer', }, ..... // Fuses are used to enable/disable various Electron functionality // at package time, before code signing the application new FusesPlugin({ version: FuseVersion.V1, [FuseV1Options.RunAsNode]: false, [FuseV1Options.EnableCookieEncryption]: true, [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, - [FuseV1Options.EnableNodeCliInspectArguments]: false, + [FuseV1Options.EnableNodeCliInspectArguments]: true, [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, - [FuseV1Options.OnlyLoadAppFromAsar]: true, + [FuseV1Options.OnlyLoadAppFromAsar]: false, }),
A decent interim solution, but its not preferable to disable asar https://www.electronjs.org/docs/latest/tutorial/asar-archives.
Also, unfortunately disabling asar leads to another error for me https://github.com/electron/forge/issues/3371
I converted my repo from electron-builder to electron-forge and somewhere along the way npm or node_modules cache was stuck. Cloning my repo in a new directory and fresh npm install fixed this issue.
I too ran into the same issue, and after some investigation, I found that the files to be packaged into asar cannot have soft links because the path resolving algorithm is buggy.
Potentially related to this symlink issue https://github.com/electron/asar/pull/308
Sorry to comment on a closed issue, but I'm hoping someone might be able to tell me (a) when this might be released or (b) how I can use it before it's released. (I've tried checking out electron/forge main and yarn linking to it as described in the "Running Forge Locally" section of "Contributing" and replacing electron-forge in package.json with my local version (which I'd prefer to avoid), but the problem persisted in both cases.)
Sorry to comment on a closed issue, but I'm hoping someone might be able to tell me (a) when this might be released or (b) how I can use it before it's released. (I've tried checking out electron/forge main and yarn linking to it as described in the "Running Forge Locally" section of "Contributing" and replacing electron-forge in package.json with my local version (which I'd prefer to avoid), but the problem persisted in both cases.)
The problem is caused by @electron/asar, so just update @electron/asar dependency
Pre-flight checklist
Electron Forge version
7.3.1
Electron version
29.1.5
Operating system
macOs 13.0.1
Last known working Electron Forge version
No response
Expected behavior
I expect my application to package without errors
Actual behavior
I am encountering an unhandled rejection error while packaging my Electron project using electron-forge package on macOS. The error message is as follows:
❯ Packaging application › Determining targets... ❯ Packaging for arm64 on darwin ✔ Copying files ⠋ Preparing native dependencies
The issue only occurs on macOS during the packaging process. However, the project builds and runs successfully on Windows
Steps to reproduce
-
Additional information
Here are the project dependencies:
node -v 18.19.1
file
forge.config.ts
file
forge.env.d.ts
file
vite.base.config.ts
file
vite.main.config.ts
vite.preload.config.ts
file
vite.renderer.config.ts
Please help me resolve this issue or provide guidance on how to further debug the problem. Thank you!