npm启动报错——端口被占用
npm启动报错——端口被占用
问题描述
- npm启动端口被占用报错如下:可以看出9244端口被占用
1
2
3
4
5
6
7
8
9
1011月29日 18:52Port 9244 is already in use. Use '--port' to specify a different port.
npm ERR! code ELIFECYCLE
npm ERR! gpsoft@0.0.0 start: `ng serve --host 0.0.0.0 --port 9244 --proxy-config loca.conf.json --base-href /gpmes/ -o`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gpsoft@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\17420\AppData\Roaming\npm-cache\_logs\2022-11-29T10_39_02_126Z-debug.log解决办法
- 用Windows+R键,输入cmd进入DOS窗口,输入命令:netstat -ano|findstr 9244 找到该端口号对应的PID号
- 用命令taskkill /pid 11464 /F 强制杀掉进程 (11464)为PID号,显示成功过后,再次运行npm start成功运行
1
2
3
4
5
6PS D:\work\Code\dnn-gp-osm-web> npm start
> gpsoft@0.0.0 start D:\work\Code\dnn-gp-osm-web
> ng serve --host 0.0.0.0 --port 9244 --proxy-config loca.conf.json --base-href /gpmes/ -o
** Angular Live Development Server is listening on 0.0.0.0:9244, open your browser on http://localhost:9244/gpmes **