When I run my Electron app through Visual Studio Code, the main process loads, which in turn launches the index.html
page. In the index.js
script I redirect the browser window to a local html file called startup.html
, located in my scripts folder, which is just a sub folder of the app. The index.html
page does not even launch and the app generates an error with the message:
Not allowed to load local resource
In the DevTools console it also shows the resource that it is attempting to load:
file:///usr/local/lib/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/scripts/ui/startup/startup.html
If I run npm start
from my project's root folder, the app launches correctly and both the index.html
and startup.html pages get loaded.
Visual Studio Code launches electron with:
/usr/local/bin/electron
This appears to be different than launching it with just npm start
. Not sure what the difference is.
A side note: Before I added the code to launch startup.html
, the app would run from Visual Studio Code. Only after adding startup.html does it not work.
What could be causing this?