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.
Contents
How to Fix Module not found: Error: Can’t resolve ‘fs’ in Error?
- 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 },
- 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 yourwebpack.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
- Building wheel for numpy (pyproject.toml)
- UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte
- Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required in Eclipse
- Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
- SyntaxError: Cannot use import statement outside a module in nodeJs