Getting Errors Out of Nowhere
Unanswered
Band-tailed Gull posted this in #help-forum
Band-tailed GullOP
Hi all, I quit working on a project for a few weeks and recently started up again. I keep encountering issues that very each time I attempt to use 'npm run dev'. Sometimes it'll be able to load the home page, but others it'll just display a blank white screen with no errors. The other pages either throw errors when I try to visit them, or display with incorrect styling, but this sometimes randomly fixes itself when I revisit them.
Some of the error messages that I have been getting randomly are...
⨯ Error: Cannot find module './vendor-chunks/next.js'
⨯ Error: with something regarding NO SUCH FILE OR DIRECTORY at '.../.next/server/app' this error makes sense because i dont see an app folder under the server folder, any ideas as to whats causing this?
Some of the error messages that I have been getting randomly are...
⨯ Error: Cannot find module './vendor-chunks/next.js'
⨯ Error: with something regarding NO SUCH FILE OR DIRECTORY at '.../.next/server/app' this error makes sense because i dont see an app folder under the server folder, any ideas as to whats causing this?
7 Replies
Band-tailed GullOP
My code was working just fine last time I was working on this
Band-tailed GullOP
It seems that deleting my .next folder and rerunning the command resolved most of this, but can I ask why this was needed? I just read it and dont fully understand how it fixed
was the old cached data fucking me up somehow?
Basically, sometimes the cache just goes whack and the best way to solve it is just deleting the folder and running the command again.
This is a common enough thing that usually the first time a weird/buggy interaction happens in NextJS and it's clearly not a code issue (aka you used everything properly), the go to response is "delete your
.next folder and try again" and it works a lot of the time.Sometimes I would be in the middle of working on a repo and suddenly a change makes it not work anymore. I would need to stop my server, delete the folder and restart.
Band-tailed GullOP
Makes sense, thank you @Maheśvara Ive encountered this before where styling wouldnt be applied but id just keep going, this was definitely the worst ive experienced it though. Will keep this in mind going forward, thank you!