【发布时间】:2021-04-18 23:35:19
【问题描述】:
尝试运行ng serve 时出现以下错误:
Port 4200 is already in use. Use '--port' to specify a different port.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! product@0.0.0 start: `ng serve --host 0.0.0.0 --disable-host-check`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the product@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mohammad Ajo\AppData\Roaming\npm-cache\_logs\2019-08-18T18_19_41_366Z-debug.log
我已经检查了端口是否被另一个连接保留,并尝试多次更改端口,但始终收到相同的错误。
【问题讨论】:
-
关闭 vscode 并重新打开它,10 美元你正在运行多个终端
-
lsof -i :4200找到并杀死它(连姆尼森风格) -
我在 Windows 10 上使用 intelliJ。即使重新启动我的计算机,错误仍然出现。
-
进入资源监视器(可以在开始菜单中搜索),打开
network选项卡,查看哪个进程在使用4200端口和end process。 stackoverflow.com/questions/48198/…
标签: npm angular-cli