When runing react js app, it doesn’t connect to localhost unless i go to another site (like google.com) and come back with back arrow

When i run the frontend of my app with npm start it doesn’t work. It’s like if it didn’t run at all. if i go on another website like google.com and then come back with the back arrow it works. If i refresh it doesn’t work anymore.

When i look up if there’s something running on the port i’m using it says that there’s nothing, if i do the workarround of coming back with back arrow it suddently says there’s something.

I tried reinstalling node-modules, my friend runned the code on his computer he has no issues.

The only other thing that works is running the command serve -s build after a build.

I’m clueless as to what i can do to fix this problem