close

[Fixed] Module not found: Error: Can’t resolve ‘fs’ in

Today We are Going To Solve Module not found: Error: Can’t resolve ‘fs’ in in angular. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix Module not found: Error: Can’t resolve ‘fs’ in Error?

  1. How to Fix Module not found: Error: Can’t resolve ‘fs’ in Error?

    To Fix Module not found: Error: Can’t resolve ‘fs’ in Error just Run the command. If you are using Nextjs than this will be the best solution for you. Just try this below command and your error will be solved. webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { config.node = { fs: 'empty' } return config },

  2. Module not found: Error: Can’t resolve ‘fs’ in

    To Fix Module not found: Error: Can’t resolve ‘fs’ in Error just Add {node:'empty'}. To solve your error you have to just add {node:'empty'} to your webpack.config file.
    By adding yo can solve your error easily.

Solution 1 : Run the command

If you are using Nextjs than this will be the best solution for you. Just try this below command and your error will be solved.

webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
  config.node = {
    fs: 'empty'
  }
  return config
},

Solution 2 : Add {node:'empty'}

To solve your error you have to just add {node:'empty'} to your webpack.config file.

By adding yo can solve your error easily.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

Leave a Comment