ReasonJun

Next.js : Module not found: Can't resolve 'fs' 본문

Frontend/Error

Next.js : Module not found: Can't resolve 'fs'

ReasonJun 2023. 6. 19. 16:26
728x90

The error message "Module not found: Can't resolve 'fs'" in Next.js typically occurs when you are trying to import the 'fs' module, which stands for "file system," in a client-side (browser) context. However, the 'fs' module is a built-in Node.js module that is not available in the browser environment.

 

Next.js is designed to be a framework for building server-rendered React applications, and it runs primarily in a Node.js environment on the server side. The 'fs' module is available and can be used in the server-side code of a Next.js application, but it cannot be used directly in the client-side code that is executed in the browser.

 

https://bobbyhadz.com/blog/module-not-found-cant-resolve-fs

 

Module not found: Can't resolve 'fs' error [Solved] | bobbyhadz

The error Module not found: Error: Can't resolve 'fs' occurs because there has been a breaking change in Webpack version 5.

bobbyhadz.com

 

728x90
Comments