Can't resolve fs

I am running into an error that I have not seen before in all my testing and compiling of Aurelia using webpack and the command au run --host [ip address].

The error is this:

ERROR in ./node_modules/@babel/core/lib/transformation/normalize-file.js Module not found: Error: Can't resolve 'fs'

It all started when I added in lines trying to format numbers, but commenting those out is not fixing my problem now. It’s a consistent compile error when I try to run aurelia.

I tried following the stackoverflow fix from here: but then I get the following error:

ERROR in ./node_modules/jsdom/lib/jsdom/utils.js Module not found: Error: Can't resolve 'canvas' in '/home/employees/rhys/aris1/node_modules/jsdom/lib/jsdom'

I am not sure how to get around this error, or why it’s even begun to appear in my project, since I haven’t done anything with the babel loader or the jsdom itself.

Any insight would be appreciated.

1 Like

did you install a library of some sort for the formatting?
maybe you installed a node library instead of a browser one?

1 Like

I didn’t install any library, I just used Number, and Intl.Number.

1 Like

It maybe that you got auto import working, and accidentally pulled fs in without even knowing it. Worth do a global search and see

1 Like

Can you push up a repo to github for us to reproduce the issue?

1 Like

I fixed it by adding:

     node: {
   fs: 'empty'

To the module.exports section of webpack.config.js according to this github link: