Anyone know why I'm getting this error?

When I run npm run dev, I get a module not found error. It was working fine just yesterday, but today it suddenly stopped.

I deleted node_modules and reinstalled, but it's still the same. If anyone knows, please help ㅠ

by 취준생김씨778

6 answers

Nobody can tell you without the full error log lol — the key part is what xxx actually is in Cannot find module 'xxx'

by 알고리즘고수30 · ▲0

Start by checking node -v. If you're using nvm, the version changes every time you open a new terminal, so it often ends up different from yesterday.

by AI덕후302 · ▲0

I ran into the exact same thing, and it turned out to be an import path case-sensitivity issue lol. It worked fine on Windows, but as soon as I put it on Linux/Docker, I suddenly got module not found. If it’s capitalized like Components/Button, scan through and make sure it exactly matches the filename.

by 호기심천국685 · ▲0

But isn't it the most suspicious thing that something that worked fine until yesterday doesn't work today? lol Usually it's one of three things: you installed something, checked out a branch, or changed your Node version. Think about that first.

by 취준생김씨219 · ▲0

Also delete package-lock.json and try reinstalling.

by AI덕후480 · ▲0

It could also be a cache issue. Try running npm cache clean --force, delete node_modules and package-lock.json, and run npm install again. If that still doesn't work, check whether the file referenced in the dev script actually exists. It's also worth checking whether the import statement is missing a file extension.

by 궁금한사람521 · ▲0