Unable to load index.html when packed in to asar file

Hey Maxime, gret repo. I have really enjoyed using it. I have been coding an app based on it for a couple of months now and I am having some problems compling / using it on other computers beside my own. My Project works just fine on my computer but then on other computers I am getting “not allowed to load resource “file://localclonedpath/dist/index.html”.

When looking at the dist folder sure enough “index.html” is missing. When logging __dirname on this computer that won’t compile correctly it says: “/localclonedpath/node_modules/electron/dist/resources/electron.asar/renderer”, When logging __dirname on the computer that does work properly it shows “/localclonedpath/dist” and that file “index.html” is in there after running the npm start. So why do you think the results of npm start are different on the different computers?

A couple of version stuff that i can think to provide:
Working Computer:
Windows 10
git version 2.10.2.windows.1
npm 3.10.8
node 6.9.1
process.versions.electron 1.7.8
process.versions.chrome 58.0.3029.110

Computer that isn’t working:
Ubuntu Desktop 18.04 LTS
git version 2.17.1
npm 3.5.2
node v8.10.0
process.versions.electron 1.7.8
process.versions.chrome 58.0.3029.110

I also did this on a Windows server 2016 and I am getting the same problem where it doesn’t have the renderer information directly in the dist folder. So I am just confused and not sure what to do with the fact that this works on my computer but after I clone it and run npm install, then npm run. It doesn’t seem to work.

1 possible answer(s) on “Unable to load index.html when packed in to asar file

  1. I found a solution. I changed the output folder of “electron-builder”, then it works.

    "build": { "directories": { "output": "release/" } },