ng serve --open报告端口4200在未使用时已经在使用中 [英] ng serve --open reports port 4200 is already in use when it isn't
问题描述
当我尝试使用命令运行我的角度应用程序
When I try to run my angular app using command
ng服务-o --port 4200
它显示类似这样的错误
端口4200已在使用中,请尝试使用其他端口
但是我检查了一下,使用此命令在该端口中没有正在运行的进程
But I checked that, there is no running process in that port using this command
sudo lsof -i -P -n | grep LISTEN
我也尝试了不同的端口,但结果相同,表明该端口也在使用中.
I have also tried different ports but result is same showing that port is also in use.
当我尝试动态端口选择命令(--port 0)时,应用程序运行.但是我必须指定端口号.
When I tried dynamic port selection command ( --port 0 ) the app runs . But I must have to specify the port number.
我正在使用
节点版本-8.12.0
角版本-5.2.6
Angular CLI版本-1.7.1
I am using
Node version - 8.12.0
Angular version - 5.2.6
Angular CLI version - 1.7.1
推荐答案
遇到相同的问题,这是Portfinder的较差版本.在他们修复它之前,直接在devDependences中指定:
Had the same problem, it's a bad version of portfinder. Until they fix it, specify directly in devDependences:
"portfinder": "1.0.20",
这篇关于ng serve --open报告端口4200在未使用时已经在使用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!