npm start报告“端口XXX上已在运行某些内容".不管XXX是什么 [英] npm start reports "Something is already running on port XXX" no matter what XXX is

查看:128
本文介绍了npm start报告“端口XXX上已在运行某些内容".不管XXX是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试npm启动我的Web应用程序的前端,而npm start给了我以下内容:

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

Something is already running on port 3000.

我尝试了lsof -i :3000,但没有在3000上运行.我尝试修改package.json来更改为另一个端口以启动我的应用程序,但是无论该端口是3000、30006还是其他任何内容,它仍然显示Something is already running on port XXX. .如果我将浏览器指向localhost:XXX,它将只说ERR_CONNECTION_REFUSED,因为那里什么也没有运行.

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.

我很确定这不是代码的问题,因为该应用程序可以在另一台计算机上启动.无论如何,在这里真的很渴望提出建议.我将我的package.json粘贴如下:

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"
  ]
}

推荐答案

感谢所有评论,实际上此答案对 https://stackoverflow.com/a/49520791/7203672 .

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

我实际上尝试了所有方法来杀死该进程,找到该进程或重新安装依赖项,但是我从来没有想到这是我的/etc/hosts的问题.问题是我有126.0.0.1本地主机而不是127.0.0.1,几天前我可能打错了字,我不知道.

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.

这篇关于npm start报告“端口XXX上已在运行某些内容".不管XXX是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆