Next.js Discord

Discord Forum

Overnight my local development stopped working and throws errors, but vercel deployments work

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Yesterday, my local development environment was working fine, and today, it has stopped working with the following error:

 â—‹ Compiling /_error ...
[next]  ✓ Compiled /dashboard in 5.2s (3628 modules)
[next] Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
[next] 
[next] Check your code at _app.tsx:137.


I tried reverting to an earlier commit, still same issue.
I tried deleting node_modules, .next build folder, reinstalling everything with a fresh yarn.lock ( kept my original as a backup )
I am able to make changes like add a console log and push to remote and Vercel is able to build and deploy my app without issue.

Something changed on my computer overnight, and now this is happening. I have no idea what could have changed, other than the fact that my computer did restart due to a problem early this morning.

The next step is to delete the repository from local and clone it again.

Has anyone seen this sort of issue before?

3 Replies

Cape lionOP
Same issue after deleting the repo from local and cloning again.
Cape lionOP
- error Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Cape lionOP
and of course as usual, as soon as I ask for help, I find the issue. I don't know why this started happening, but I had to change the way I imported a component for it to start working locally again. Worked just fine yesterday, worked when deployed to vercel, but locally was not importing properly.