Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm start reports "Something is already running on port XXX" no matter what XXX is

I am trying to npm start my web app's frontend, and npm start gives me following:

Something is already running on port 3000.

I tried lsof -i :3000 and nothing's running on 3000. I tried modifying package.json to change to another port to start my app, but it still says Something is already running on port XXX no matter what that port is, 3000, 30006, or anything. If I point my browser to localhost:XXX it will just say ERR_CONNECTION_REFUSED because nothing's running there.

I'm pretty sure it's not the code's problem because the app can be started on another machine. Anyway, really desperate for suggestions here. I pasted my package.json as follows:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "node-sass": "^4.10.0",
    "react": "^16.5.0",
    "react-dom": "^16.5.0",
    "react-scripts": "1.1.5"
  },
  "scripts": {
    "start": "PORT=30006 react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:3001",
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}
like image 882
张枫旸 Avatar asked Oct 12 '25 11:10

张枫旸


1 Answers

Thanks for all the comments, actually this answer helps https://stackoverflow.com/a/49520791/7203672.

I literally tried all methods to kill the process or find the process or reinstall the dependecies but it just never occurred to me that this is a problem with my /etc/hosts. And the problem is I have 126.0.0.1 localhost instead of 127.0.0.1, I probably made a typo some days back, I have no idea.

Lessons learned, should've tried every answer under that post before posting the question.

like image 133
张枫旸 Avatar answered Oct 14 '25 02:10

张枫旸