edge-cs.dll cannot be loaded in electron app when packaged in asar

Created on 2 Apr 2016  路  10Comments  路  Source: tjanczuk/edge

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\鈥\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?

Most helpful comment

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.

All 10 comments

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? 馃榿

@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/**

Was this page helpful?
0 / 5 - 0 ratings

Related issues

node2013 picture node2013  路  3Comments

sz30313484 picture sz30313484  路  7Comments

agracio picture agracio  路  6Comments

bravomikekilo picture bravomikekilo  路  6Comments

carlskii picture carlskii  路  13Comments