Next.js Discord

Discord Forum

Getting error for a module I did not use or import

Answered
Gharial posted this in #help-forum
Open in Discord
GharialOP
can someone help me understand why am I getting this error -

./node_modules/next/dist/trace/report/to-json.js:25:51
Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

I did not use fs anywhere in my code
Answered by Gharial
Okay so I ctrl=z'd a bunch of times until it started working again. And then I wrote the exact same code but now I don't have error
View full answer

10 Replies

Haven't seen this error, so im not sure but can you confirm whether you are using outputting a trace file?

Paste your next config file here
GharialOP
I did not change it so it's just the vanilla code you get when creating a new project but anyway. here -
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
Any instrumentation file?

Try deleting node_modules and the .next folder and then restart the server
GharialOP
Okay so I ctrl=z'd a bunch of times until it started working again. And then I wrote the exact same code but now I don't have error
Answer
GharialOP
I don't know what or why it happened
but thanks for helping out
🗿
Welp
GharialOP
Ikr 😭 I literally have no idea why it works now
cuz the code is exact same no change just rewritten