Module not found: Error: Can't resolve 'fs'

Below are the two error I’m facing
I’m using Ionic 4

I have imported Woocommerce API, but when I initialize it in constructro it shows both of this error.

You have to go to folder \node_modules@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\browser.js and replace node: false, by node: { crypto: true, stream: true, fs: “empty”, net: “empty”, tls: “empty” },
It’s working for me.

1 Like

It worked! thanks :smiley:

In my case, I added

node: { fs: ‘empty’ }

That is not the solution. You are importing a package that is mean for node, not for the browser. Find a woo-commerce library that is built for the browser, not node.

1 Like