Uncaught SyntaxError: Unexpected token '<' #59879
Unanswered
aasokvolvo
asked this question in
Help
Replies: 1 comment
-
Same issue, i followed tutorial from next.js website https://nextjs.org/learn/dashboard-app/setting-up-your-database. Everything works fine in local dev, and when i deployed to vercel, the build and deployment was successful but when loading the page the chunks can't be parsed: I've been searching for couple hours but find no solution |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I am using Next 14 and created a sample create next app. I am able to build and run the app locally without any fail. But, when I deploy the same to server, I am getting Uncaught SyntaxError: Unexpected token '<' in several pages and a warning as well "The resource ***/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
as
value and it is preloaded intentionally."I think it is not able to load the static files
In my server.js config part looks like below:
app.use(express.static(".next/static"));
app.get("/*", function (req, res) {
res.sendFile(
path.join(__dirname, "./.next/server/app/index.html"),
function (err) {
console.log("inside server.js file");
console.log(__dirname);
console.log(path);
if (err) {
res.status(500).send(err);
}
}
);
});
Could you please help me with this?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions