When I visit my website I cannot reload it

When i open my website it is all fine and working but when I go to any page from the header and reload/refresh the page it shows errors like this:
404: NOT_FOUNDCode: NOT_FOUNDID: bom1::jlwfm-1744309373433-7f82699a419a
I don’t know how can I fix it I have asked every AI and he is not able to fix it too.

Also I am getting unknown errors when deploying like:

[23:17:00.854] Skipping build cache, deployment was triggered without cache.
[23:17:01.499] Cloning completed: 654.000ms
[23:17:01.865] Running build in Washington, D.C., USA (East) – iad1
[23:17:02.035] Running "vercel build"
[23:17:02.417] Vercel CLI 41.5.0
[23:17:02.510] Error: Can't parse json file /vercel/path0/package.json: Expected ',' or '}' after property value in JSON at position 298 while parsing '{
[23:17:02.510]   "name": "vite_react_shadcn_ts",
[23:17:02.510]   "p'
[23:17:02.713]

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

1 Like

Hi, @murtazanaqvicoder! Welcome to the Vercel Community :waving_hand:

Did you check out the resource above? Does it help?

Yes, i checked it but it didn’t helped me. Also i have tried many fixes but none worked. It would be very great if you help me with my project as it is my first project with node.js and with vercel. Thanks Alot!

Hey @murtazanaqvicoder your deployment error suggests your package.json file might me malformatted? I would first review that. More than happy to take a look if you have the repository available.

1 Like

I have fixed that all the whole code was messed up.

@murtazanaqvicoder nice! are you still experiencing the 404 issues?

Yes, I don’t know why is it coming. It would be great if you would check my code or fix this error in all possible ways. All the deployment errors are now gone only this refresh issue still remains.

1 Like

Do you have a repository I could view? More than happy to take a look.

2 Likes

Sure, Here’s It:

Tell me the fix or changes that i should do to prevent this error.

1 Like

@murtazanaqvicoder Ah, I’ve run into this before with Vite projects. The issue is with React Router. Vite produces an SPA by default, and React Router just uses techniques like history.pushState for routing.

So you need all routes to redirect to the root SPA file (index.html), which you can do with a vercel.json config file in the root of your project:

{
  "rewrites": [
    {
      "source": "/(.*)",
      "destination": "/index.html"
    }
  ]
}

I have a demo of the fixed site here, which I will remove later to keep my account clean:

Let me know how it works!

3 Likes

Thanks alot man i appreciate it alot!
so the code you gave me i have to write it in a newly created vercel.json file?
Am i right?
Btw i have seen the site so you can delete it now.

1 Like

Yes! Or your existing one :smiley:

Done, Its Fixed thanks alot for your help.
Just a humble request to delete the website that you created and the code as it’s my property.

1 Like

Yep!

For sure, I’ll remove it now! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.