ERROR in ./node_modules/electron/index.js Module not found: Error: Can't resolve 'fs'
See original GitHub issueIt shows an error when I try to run npm test. Any ideas?
ERROR in ./node_modules/electron/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/electron'
resolve 'fs' in '/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/electron'
Parsed request is a module
using description file: /Users/dnguyen/Documents/projects/random/angular-electron/node_modules/electron/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
looking for modules in /Users/dnguyen/Documents/projects/random/angular-electron
using description file: /Users/dnguyen/Documents/projects/random/angular-electron/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/dnguyen/Documents/projects/random/angular-electron/package.json (relative path: ./fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/fs doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/fs.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/fs.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/fs.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/fs.js doesn't exist
as directory
/Users/dnguyen/Documents/projects/random/angular-electron/fs doesn't exist
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/electron/node_modules doesn't exist or is not a directory
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/node_modules doesn't exist or is not a directory
/Users/dnguyen/Documents/projects/random/node_modules doesn't exist or is not a directory
/Users/dnguyen/Documents/projects/node_modules doesn't exist or is not a directory
/Users/dnguyen/Documents/node_modules doesn't exist or is not a directory
/Users/dnguyen/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/dnguyen/Documents/projects/random/angular-electron/node_modules
using description file: /Users/dnguyen/Documents/projects/random/angular-electron/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/dnguyen/Documents/projects/random/angular-electron/package.json (relative path: ./node_modules/fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.js doesn't exist as directory
/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs doesn't exist
[/Users/dnguyen/Documents/projects/random/angular-electron/fs]
[/Users/dnguyen/Documents/projects/random/angular-electron/fs.ts]
[/Users/dnguyen/Documents/projects/random/angular-electron/fs.tsx]
[/Users/dnguyen/Documents/projects/random/angular-electron/fs.mjs]
[/Users/dnguyen/Documents/projects/random/angular-electron/fs.js]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/electron/node_modules]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/node_modules]
[/Users/dnguyen/Documents/projects/random/node_modules]
[/Users/dnguyen/Documents/projects/node_modules]
[/Users/dnguyen/Documents/node_modules]
[/Users/dnguyen/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.ts]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.tsx]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.mjs]
[/Users/dnguyen/Documents/projects/random/angular-electron/node_modules/fs.js]
@ ./node_modules/electron/index.js 1:9-22
@ ./src/app/providers/database.service.ts
@ ./src/app/app.component.ts
@ ./src/app/app.component.spec.ts
@ ./src sync \.spec\.ts$
@ ./src/test.ts
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Module not found: Can't resolve 'fs' in 'node_modules\electron'
Summary I am experiencing issues importing packages. Here, i imported ipc using import { ipcRenderer } from 'electron'. However, it doesn't ...
Read more >Electron and TypeScript: 'fs' can't be resolved - Stack Overflow
Local environment is OS X High Sierra. The problem is that I can't even build my app and I get error on building...
Read more >module not found: Error: Can't resolve 'fs' : r/electronjs - Reddit
I'm getting this error by running `electron-forge make`: ERROR in ./node_modules/electron/index.js 1:11-24 Module not found: Error: Can't ...
Read more >module not found error can't resolve 'fs' in electron - You.com
To solve the "Cannot find module fs or its corresponding type declarations" error, install the types for node by running the command npm...
Read more >Module not found: Can't resolve 'fs' error [Solved] | bobbyhadz
The error "Module not found: Error: Can't resolve 'fs'" occurs because there has been a breaking change in Webpack version 5. To solve...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Give a look at this https://github.com/angular/angular-cli/issues/10681
The weird thing is that it only happen when i run npm test. Running the application normally dont trigger any issue