Electron with Angular 4 erroring



       I am using Angular 4 (similar as Angular 2) with electron. When I am trying to use electron command then I am receiving an error.

Error at run time: Uncaught TypeError: fs.existsSync is not a function

What I am trying to write:

import { shell } from ‘electron’;

/ /later in code in a method:

shell.openExternal(url); // to open a browser window.

This error is not only for this command but it appears on any command from electron. Anybody any idea about this and how to fix it.



Imho problem lies somewhere whithin filesystem package, try to update it…


The problem was that angular does not understand nodejs and electron apis, so it throws build time errors.
The easy solution was to import the shell variable at the root html file.


I’m trying to integrate Electron with the latest version of Angular (v5) and I’m also encountering this error when trying to execute dialog.showOpenDialog.
@amitabharya23 Could you explain a bit more in detail what you did resp. do you have a code snippet?


Finally, I ended up with this: http://electron.rocks/angular2-electron/