Hello! Could anyone that gets nextjs help me understand this error I get when running
npm run build
npm run build
:
Failed to compile../app/page.tsx + 1 modulesUnexpected end of JSON input> Build failed because of webpack errorserror: script "build" exited with code 1
Failed to compile../app/page.tsx + 1 modulesUnexpected end of JSON input> Build failed because of webpack errorserror: script "build" exited with code 1
It only happens when I try to link a component from my /app/components directory into my page.tsx.
npm run dev
npm run dev
works fine with no errors, and deploying on vercel also works fine, it's just building locally that's the issue.
Solution
i'd try creating a new app and seeing if the issue persists