edge
edge copied to clipboard
edge-cs.dll cannot be loaded in electron app when packaged in asar
Not sure if this is the right place to ask this question, but I'm trying to use edge in my electron app (using https://github.com/kexplo/electron-edge). Everything works fine when I run the app unpackaged, however when I package the app into an asar file, I see
Error: Could not load file or assembly 'file:///C:\app\v0.36.2\win32-x64\…s\app.asar\node_modules\electron-edge\node_modules\edge-cs\lib\edge-cs.dll' or one of its dependencies. The system cannot find the file specified.
at Error (native)
at Object.exports.func (C:\app\v0.36.2\win32-x64\resources\app.asar\node_modules\electron-edge\lib\edge.js:157:17)
I've found other threads (https://github.com/atom/electron/issues/1802, for example) saying that I need to unpack the dlls. I did that, but still seeing the errors. I'm thinking that whatever loads edge-cs.dll needs to know to look in the unpacked folder?
Me too. I am with this problem!
node_modules\edge-cs is not packed into asar archive - contains executable code node_modules\electron-edge is not packed into asar archive - contains executable code
What I do?
Too. Same error.
Same issue here as well. Really hoping for a fix.
Well it seems there is a solution after all, thanks to this
To fix this, I went inside my node_modules
folder, deleted the edge-cs
folder and replaced it with edge-asar-cs
, after that I renamed this new folder edge-asar-cs
into edge-cs
and it worked.
I hope this helps someone else. Good evening.
I hope this helps someone else.
change edge-cs/lib/edge-cs.js
, add .replace('app.asar', 'app.asar.unpacked')
var path = require('path');
exports.getCompiler = function () {
return process.env.EDGE_CS_NATIVE || (process.env.EDGE_USE_CORECLR ? 'Edge.js.CSharp' : path.join(__dirname, 'edge-cs.dll').replace('app.asar', 'app.asar.unpacked'));
};
exports.getBootstrapDependencyManifest = function() {
return path.join(__dirname, 'bootstrap', 'bin', 'Release', 'netstandard1.6', 'bootstrap.deps.json');
}
change electron-packager asar
propertiy
"asar":{
"unpackDir": "node_modules/edge-cs/**"
},
@Augus can you clarify what you mean by 'change electron-packager asar propertiy' ? I can't find which file to make this change.
Same, what exactly do I need to change? 😁
@hohks12 https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#asar
@Augus I am logged in just to give you a compliment
change electron-packager asar propertiy
"asar":{ "unpackDir": "node_modules/edge-cs/**" }
You can also add it as a command line argument:
electron-packager --asar.unpackDir=node_modules/edge-cs/**