-1

I downloaded a repo of a react app from github and installed all the necessary dependencies. Then in ran npm start which started the dev server on localhost:3000. While on this port the app is showing a blank page but if I run the dev server on a different port like localhost:3001, it works fine but I need it to run on localhost:3000.

I searched for the solution on google and tried every single solution possible to fix this issue, but nothing is solving it.

How do I make my app work on localhost:3000 rather than other ports?

Tushar Shahi
  • 16,452
  • 1
  • 18
  • 39
saimurm360ict
  • 21
  • 1
  • 4

1 Answers1

0

Remove the explicit PORT argument from your scripts in package.json

looks something like this

"start": "PORT=3001 react-scripts start"

or if there's an env file containing the port Variable?

remove it.

make sure you are not running multiple react apps, that will make your app use another port if the default port is busy.

leme know if it fixies the issue if not .. please link to the repo you are using.

  • I want my app to work on port `3000` not to open on a different port. – saimurm360ict Jan 02 '22 at 11:09
  • The problem you are having is genrally caused by the things mentioned above. Make sure the port is not busy, and there are no explicit port arguments passed this usually solves the issue.. if not please link the repo you are using. – RONNIE RAWAT Jan 02 '22 at 11:13
  • `https://github.com/ssaimur/fbcClone-front.git` this is my repo, try cloning this repo and get the front page from this app on port `3000`. If you open this app on port `3001` you can't be able to login or register. – saimurm360ict Jan 02 '22 at 12:00
  • http://localhost:3000/register .. for me the app started in localhost 3000 it only means that you had another app running on the default port ie 3000. You can only host one app on a port at a time (doesn't matter if it's an express angular or react app). If you are not running multiple apps try restarting your system. The port might not have been closed properly . if none of this works make sure you havn't set any Port variables using the terminal . side note : it's a nice looking app and sorry about creating a test account .. you can delete it – RONNIE RAWAT Jan 02 '22 at 13:11