Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React js isn't running my app on localhost:3000

hi all i used to work on MERN project for sometime but now my react app wont run on localhost:3000. So far i tried the following

  1. Updated node.js/ reinstalled node.js
  2. create new app using npx create-react-app but still localhost:3000 isn't working

I checked if port is opened or not using netstat -aon but localhost:3000 wasn't there. But 0.0.0.0:3000 is there. So my attempt to run telnet 127.0.0.1 3000 was not successful.

Am using windows 10 OS and latest version of nodejs

like image 820
oblak Avatar asked Apr 04 '20 16:04

oblak


2 Answers

create .env file at the root of your project and add this line:

PORT = 3000

Then npm start again

like image 101
carrany Avatar answered Sep 21 '22 09:09

carrany


Try the solution from this topic.

In package.json edit next string from this

"start": "react-scripts start"

to this

"start": "set PORT=3000 && react-scripts start"
like image 20
aopanasenko Avatar answered Sep 22 '22 09:09

aopanasenko