cyn
cyn

Reputation: 858

Uncaught TypeError: r.existsSync is not a function in Angular 6 and Electron desktop application

I am upgrading a desktop application to Angular 6 from Angular 5 and Electron 2 framework but getting this error when I run/build the app: npm start which runs electron ..

Error:

Uncaught TypeError: r.existsSync is not a function
at Object.<anonymous> (main.4ff68b38699fd48ecfa7.js:1)
at Object.vbkW (main.4ff68b38699fd48ecfa7.js:1)
at p (runtime.a66f828dca56eeb90e02.js:1)
at Object.zUnb (main.4ff68b38699fd48ecfa7.js:1)
at p (runtime.a66f828dca56eeb90e02.js:1)
at Object.7 (main.4ff68b38699fd48ecfa7.js:1)
at p (runtime.a66f828dca56eeb90e02.js:1)
at n (runtime.a66f828dca56eeb90e02.js:1)
at Array.e [as push] (runtime.a66f828dca56eeb90e02.js:1)
at main.4ff68b38699fd48ecfa7.js:1

I think this is an issue only with Angular 6. I could not understand much from this error stacktrace. The application is working perfectly fine in Angular 5. Any help is much appreciated.

Upvotes: 1

Views: 835

Answers (2)

udalmik
udalmik

Reputation: 7998

Something must be broken with the packaged bundle. This issue looks very similar.

Could you try to replace require('fs') with window.require('fs') as suggested there.

Upvotes: 1

Sachila Ranawaka
Sachila Ranawaka

Reputation: 41447

did you import the module using require.

var r= require('fs');

Upvotes: 0

Related Questions