Module not found on deployment: Can't resolve '@/components/navbar'
Answered
British Shorthair posted this in #help-forum
British ShorthairOP
This is the first time I'm seeing this problem. It's weird because on development mode everything works fine, but on deployment it shows this error:
I'm importing a Navbar component from the main page of my website
I'm importing a Navbar component from the main page of my website
app/[lang]/page.tsx. The navbar is located at components/navbar. Can someone tell me where the problem is?Answered by joulev
maybe it's due to casing? https://nextjs-faq.com/module-not-found-due-to-case-sensitivity
9 Replies
@British Shorthair This is the first time I'm seeing this problem. It's weird because on development mode everything works fine, but on deployment it shows this error:
I'm importing a Navbar component from the main page of my website `app/[lang]/page.tsx`. The navbar is located at `components/navbar`. Can someone tell me where the problem is?
maybe it's due to casing? https://nextjs-faq.com/module-not-found-due-to-case-sensitivity
Answer
British ShorthairOP
well i only changed the first letter from uppercase to lowercase
but I changed all imports
and in development mode it works fine
yeah then it's definitely due to casing
go check the filename on github and use the casing there
on windows/mac the fs is case insensitive so we cannot really trust the casing displayed by vscode
British ShorthairOP
ok thanks
it works now