fs.existsSync() is not a function


(Venkatesh Padmanabhan) #1

Hello,

I have an electron application built as desktop application, and while writing unit test cases I see electron uses fs as the dependent module for its execution with the webpack .

As I use fs in require , it is giving me empty object as I see in npm fs module is deprecated.

Can I have a support from you so that it would be helpful to me.

I have attached the error log from the compilation due to which the karma configuration is failing…

index.js:6 Uncaught TypeError: fs.existsSync is not a function
at Object. (index.js:6)
at Object…/node_modules/electron/index.js (index.js:10)
at webpack_require (bootstrap a0c12a533c27560c6266:54)
at Object…/src/renderer/app/providers/electron.service.ts (electron.service.ts:6)
at webpack_require (bootstrap a0c12a533c27560c6266:54)
at Object…/src/renderer/app/providers/menu.service.ts (menu.service.ts:3)
at webpack_require (bootstrap a0c12a533c27560c6266:54)
at Object…/src/renderer/app/app.component.ts (app.component.ts:1)
at webpack_require (bootstrap a0c12a533c27560c6266:54)
at Object…/src/renderer/app/app.component.spec.ts (app.component.spec.ts:3)

Thanks in advance,
Venkatesh


(Lars Willighagen) #2

This thread might be of help:

It’s unlikely to be caused by npm itself.


(system) #3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.