Unexpected end of JSON input
Answered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Just created a completely new nextjs project using the create next app command and am already getting errors when I try to build it? Not sure what's going on but this is ahppening with all my nextjs projects. Wtf am I supposed to do.
seifabdelaziz@Mac my-next-app % bun run build
$ next build
▲ Next.js 15.0.3
Creating an optimized production build ...
Failed to compile.
./src/app/page.tsx + 1 modules
Unexpected end of JSON input
> Build failed because of webpack errors
error: script "build" exited with code 1
seifabdelaziz@Mac my-next-app %Answered by Transvaal lion
i was able to fix the issue by completely uninstall node and reinstalling it agian
7 Replies
Belgian Hare
@Transvaal lion Can you show the source of /src/app/page.tsx?
This error occurs if you run
JSON.parse on a malformed JSON string (on the server)Transvaal lionOP
it's the default page.tsx that you get from runing creat enxt app
Transvaal lionOP
i was able to fix the issue by completely uninstall node and reinstalling it agian
Answer
Transvaal lionOP
no idea what the hell aws happening
Belgian Hare
It could be that you were using an older version of node see:
https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#nodejs-version
https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#nodejs-version
Transvaal lionOP
ty