Can't resolve 'fs'
See original GitHub issueError compiling page in console:
[ ready ] compiled successfully
ready at http://localhost:3000
[ event ] build page: /
[ wait ] compiling ...
[ error ] ./node_modules/destroy/index.js
Module not found: Can't resolve 'fs' in ''C:\Users\admin\projects\gast\node_modules\destroy'
Could not find files for /index in .next/build-manifest.json
ModuleNotFoundError: Module not found: Error: Can't resolve 'fs' in 'C:\Users\admin\projects\gast\node_modules\destroy'
I have not used any new packages. It just came out of nowhere I tried to install all the packages again in a separate folder and transfer the necessary components there. Nothing has changed, the same error
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Module not found: Error: Can't resolve 'fs' in
I found a possible solution, that you have to put some configuration in one of the node_modules. But I think that is not...
Read more >How To Solve Module Not Found Can't Resolve 'fs' in Next.js
The Module not found : Can't resolve 'fs' error and similar issues most likely occur when you try to import a module that...
Read more >Can't resolve 'fs' error in Next.js and WebPack
The Module not found: Can't resolve 'fs' in Next.js error occurs when you import a Node.js module that is not available in the...
Read more >Can't resolve 'fs' when bundle with webpack · Issue #447
I got this error when using the "fetch" library from npm. At first I got the same error but with other packages (...
Read more >module not found error can't resolve 'fs' in react js
The "Module not found: Can't resolve 'fs'" error in React is caused by a missing or incorrect dependency. To solve this problem, you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

For newer versions of next that use webpack5, use the following in your
next.config.jsinstead (see for example):In general it means you’re importing a server-only dependency in code that will be shipped to client-side users.
@BjoernRave it’s not recommended to add that as server-only libs are generally massive and will bloat bundle size while working incompletely client-side.
Please follow the issue template.
https://github.com/zeit/next.js/issues/new/choose
https://github.com/zeit/next.js/issues/new?template=8.Question_about_next.md