-
Notifications
You must be signed in to change notification settings - Fork 169
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
bytecodePlugin doesn't work with electron 27.0.0 (MacOS universal) #315
Comments
I see that you have committed ac47dac Will you be publishing a new npm package soon? Also, is this something that should be customizable by the user? It seems to be a potential maintenance issue when a new major electron version comes out. If a new version comes out, it'd be nice if I can manually specify the node and chrome version being used. |
I wonder why it works no problem in 26 but not in 27 with the same config? We haven't changed our build processes at all between 26 and 27. We're also not manually specifying the electron version anywhere as your doc says could be an issue. |
Whether tested on the same operating system and the same architecture? |
I think you package your app with electron-builder's universal mode, |
We've always been building Mac universal for the entire 25 and 26 electron without issues Our CI build process hasn't changed at all |
This depends on the operating system architecture. If it is built with x64, you will have this error when installing on arm64, but there will be no problem when installing on x64. If it is built with arm64, there will be this error when installed on x64, but there will be no problem when installed on arm64. Bytecode is related to architecture. You can use the old version to test. I think CI is usually based on x64 architecture. You can install the old installation package in the m1/m2 macOS and this problem will be reproduced. |
My machine is an M2 and the 26 builds have no issues running. We've also tested with intel machines too. |
You can also find our 26 build for mac universal on our download page. We only build for mac universal. |
Usually there will be problems with universal. You can try to package them into x64 and arm64 to see if the problem still exists. |
I don’t know if the universal installation package still selects x64 when installing m1/2. |
I learned from some developers that it is amazing that x64 bytecode can run in arm64, but it shouldn't be possible normally. This issue occurred after upgrading to version 27. this is a confusing issue. |
Is there a way for the plugin to generate bytecode for both arch and then select the correct one to use in a universal package? |
@theogravity Maybe it's possible. Check out: https://www.electron.build/configuration/mac.html Note the |
@theogravity Have you found a way to handle universal packaging with bytecode? Can you share it? |
I haven't tried anything yet. I'll probably not try it out until we actually need to upgrade to 27. |
I faced the same issue with x64 build for windows/linux on mac m1 (arm64 mac version works well on m1). I can't install the version on win x64 nor arm64. The issue occurs on Electron 27 and 28 (beta) but 26 works good. |
I had the same issue, but is resolved for now. The key to solving the problem was to run const { downloadArtifact } = require('@electron/get');
const { log } = require('builder-util');
const { spawnSync } = require('child_process');
const { Arch } = require('electron-builder');
const unzip = require('extract-zip');
const fs = require('fs');
const path = require('path');
const electronAppDirPath = path.resolve(__dirname, '.electron');
const getMacElectronAppPath = async (arch, version) => {
log.info({ arch }, 'generate darwin electron according to arch');
const zipPath = await downloadArtifact({
version,
platform: 'darwin',
artifactName: 'electron',
arch,
});
await unzip(zipPath, { dir: electronAppDirPath });
return path.resolve(
electronAppDirPath,
'Electron.app/Contents/MacOS/Electron',
);
};
const build = (option) => {
return new Promise((resolve) => {
const isAlpha = process.env.npm_lifecycle_event.includes('alpha');
const buildCommand = isAlpha ? 'build:alpha' : 'build';
log.info(`electron-vite ${buildCommand}`);
const std = spawnSync('npm', ['run', buildCommand], option);
if (std.stderr && std.stderr.length > 0) {
log.error(std.stderr.toString());
}
resolve();
});
};
exports.default = function (context) {
return new Promise((resolve) => {
const version = context.packager.info._framework.version;
const platform = context.electronPlatformName;
const arch = Arch[context.arch];
if (platform !== 'darwin') {
resolve();
return;
}
getMacElectronAppPath(arch, version)
.then((appPath) => {
return build({
env: {
...process.env,
ELECTRON_EXEC_PATH: appPath,
},
});
})
.finally(() => {
fs.rmSync(electronAppDirPath, { recursive: true, force: true });
resolve();
});
});
}; However, the process is quite complicated. Hopefully there will be some improvements when using the bytecode plugin. |
@alex8088 bytecode plugin issue still occurs with Electron 28 and electron-vite 2.0.0. Do you have any ideas on how to solve this problem? |
在构建Mac universal app时,使用electron@28,我也遇到了同样的问题,我想知道这个问题是可以解决的吗 |
Too. |
The deep problem lies within the need to compile the bytecode, under Linux, using the Windows electron.exe file. I tried a lot of workarounds, but Wine can't run electron.exe as a node properly under a Linux container, it is very hard to pass the input to the stdin of the wine-electron process. After a day of struggling with it, I managed to make Wine run electron.exe inside the container and pass the stdin of the compiled file to the process, I quit when I realized that Wine had two problems: first you need to make wine to manage to run node_modules/electron/dist/electron.exe without any errors. by adding:
I managed to make But:
|
electron-vite build also not working for windows when using bytecodeplugin out/main/index.js 59.17 kB
node:events:495
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:962:11)
at Socket._write (node:net:974:8)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at file:///home/user/project/node_modules/electron-vite/dist/index.mjs:35:24
at new Promise (<anonymous>)
at compileToBytecode (file:///home/user/project/node_modules/electron-vite/dist/index.mjs:26:12)
at file:///home/user/project/node_modules/electron-vite/dist/index.mjs:276:54
at Array.map (<anonymous>)
at Object.writeBundle (file:///home/user/project/node_modules/electron-vite/dist/index.mjs:258:39)
at file:///home/user/project/node_modules/rollup/dist/es/shared/node-entry.js:19774:40
at async Promise.all (index 0)
at async PluginDriver.hookParallel (file:///home/user/project/node_modules/rollup/dist/es/shared/node-entry.js:19702:9)
at async file:///home/user/project/node_modules/rollup/dist/es/shared/node-entry.js:20699:13
at async catchUnfinishedHookActions (file:///home/user/project/node_modules/rollup/dist/es/shared/node-entry.js:20119:16)
at async build (file:///home/user/project/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67481:22)
at async build (file:///home/user/project/node_modules/electron-vite/dist/chunks/lib-GB2q6SUI.mjs:26:13)
at async CAC.<anonymous> (file:///home/user/project/node_modules/electron-vite/dist/cli.mjs:83:9)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
} |
@alon42 I have also encountered similar difficulties, mainly because it is a great idea to directly compile and push Gitlab CI, but it seems that Wine cannot accurately complete this task. In fact, I also encountered an error that asked me to delete package lock.json and interrupt compilation. The current solution may be to directly create a Gitlab runner in Windows Update: |
any update on this? |
I'd like to reopen the discussion. Is the only solution to stay with electron 26.x.x? |
Describe the bug
Electron 27 just came out, and I seem to be having problems launching my built app when using the bytecode plugin
With electron 26, there are no issues.
My configuration looks like this:
Fuse configuration:
For notarization, we use
notarytool
.package.json
fileElectron-Vite Version
1.0.28
Electron Version
27.0.0
Vite Version
4.4.11
Validations
The text was updated successfully, but these errors were encountered: