Module not found: Error: Can't resolve 'fs' in Angular 10

215 views Asked by At

I started upgrade from Angular 5 to Angular 10. Now upgraded till Angular 10 but When I'm running ng serve command then getting below error. I have already tried below two commands
'npm cache verify' then deleting node module folder then 'npm install'

Errors:

ERROR in ./node_modules/xlsx-style/dist/cpexcel.js Module not found: Error: Can't resolve './cptable' in 'D:\PD\service\angular\node_modules\xlsx-style\dist' ERROR in ./node_modules/xlsx-style/xlsx.js Module not found: Error: Can't resolve 'fs' in 'D:\PD\service\angular\node_modules\xlsx-style' ERROR in ./node_modules/xlsx-style/ods.js Module not found: Error: Can't resolve 'fs' in 'D:\PD\service\angular\node_modules\xlsx-style'

These errors was coming after upgrade from Angular 5 to 6 as well.

Please help me how i can solve this ?

Thanks

node version : 10.13.0 npm version: 6.4.1 rxjs :6.6.7 typescript:3.9.2

Already tried solutions but not working :

  1. node: { fs: "empty" } in webpack.config.js

  2. "browser": { "fs": false, "os": false, "path": false } in package.json

Already tried solutions but not working :

  1. node: { fs: "empty" } in webpack.config.js

  2. "browser": { "fs": false, "os": false, "path": false } in package.json

0

There are 0 answers