1

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"
  ]
}
张枫旸
  • 21
  • 1
  • 6
  • 2
    Possible duplicate of [Node.js Port 3000 already in use but it actually isn't?](https://stackoverflow.com/questions/39322089/node-js-port-3000-already-in-use-but-it-actually-isnt) – jknotek Mar 24 '19 at 21:30
  • See this answer: https://stackoverflow.com/a/48334685/5310914 – jknotek Mar 24 '19 at 21:30
  • @张枫旸 did the duplicate answer your question? Let us know if it didn't so your question isn't closed. – Lord Elrond Mar 24 '19 at 21:57

1 Answers1

1

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.

张枫旸
  • 21
  • 1
  • 6