Module not found: Error: Can’t resolve ‘fs’ error

The error is because of angular-cli does not support modules in node like “fs” and “path”. (Issue)

Add the following to the root of the “package.json” file.

"browser": {
  "fs": false,
  "path": false,
  "os": false
}

Angular apps such as the ones Angular CLI creates are browser apps. fs
isn’t available on the browser, it’s only available on node apps.

  • https://github.com/angular/angular-cli/issues/8272#issuecomment-341428996

Leave a Comment