-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
electron-forge to package ,return code of 0x80070002 #19
Comments
When packaging electron application Take a look at some examples here: Packaging Electron application |
I have already made this configuration:
However, it still throws an error. |
As per my previous comment |
https://github.com/eug3/e/tree/master This is my code. Thanks for the help. |
I am not very familiar with electron-forge and from quick look it does not appear that you can exclude modules from being packed into asar archive. |
rebuildConfig: {
onlyModules: [],
}, |
Based on your suggestions, I made some modifications. Although it's not very elegant, it works smoothly after running This is how I did it: packagerConfig: {
asar: {
unpackDir: "net8.0", // This is where the C# dynamic libraries are located
},
ignore: ["node_modules/electron-edge-js", "node_modules/edge-cs"],
},
hooks: {
postPackage: async (forgeConfig, options) => {
console.log("build_path", options.outputPaths);
const outdir = options.outputPaths[0];
console.log("outdir", outdir);
// Get node_modules path
const nodeModulesPath = path.join(outdir, "resources", "node_modules");
const modulesToCopy = ["edge-cs", "electron-edge-js"];
for (const moduleName of modulesToCopy) {
const sourcePath = path.join(__dirname, "node_modules", moduleName);
const targetPath = path.join(nodeModulesPath, moduleName);
console.log(
`Copying ${moduleName} from:`,
sourcePath,
"to:",
targetPath
);
fs.copySync(sourcePath, targetPath);
}
console.log("All modules copied successfully!");
},
},
... // other properties Since the dynamic libraries are packed into the if(__dirname.indexOf('app.asar') !== -1) {
baseNetAppPath = path.join(process.resourcesPath, "app.asar.unpacked", "net8.0");
} With this approach, it now works smoothly on Windows 11. Thanks for the help! |
I tried running your updated repo on my Win 10 PC and it fails with same message as before.
EDIT: resolved by changing one line in both
var version = 'core';
var net = 'core'; |
Created electron-forge example based on your repo, you are credited in README. |
Found another way to simplify electron-forge config ``forge.config.js` packagerConfig: {
asar: true ,
ignore: ["node_modules/electron-edge-js", "node_modules/edge-cs"],
extraResource: [
"net8.0/",
]
}
if (__dirname.indexOf("app.asar") !== -1) {
baseNetAppPath = path.join(process.resourcesPath,"net8.0");
} |
When using electron-forge to package and distribute the project, the following error occurs:
uncaughtException: Error: Call to coreclr_create_delegate() for G failed with a return code of 0x80070002
However, it works fine with npm start.
This is on a Windows 11 environment.
The text was updated successfully, but these errors were encountered: