npm - 端口 4200 已在使用中。使用“--port”指定不同的端口
问题描述
尝试运行时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
我已经检查了端口是否被另一个连接保留,并尝试多次更改端口,但始终收到相同的错误。
解决方案
对于 Linux 用户:- 这个对我有用
kill -9 $(lsof -t -i:4200)
推荐阅读
- mysql - 两个表的联接或联合 - SQL
- git - 如何让 Heroku 不坚持我的本地 Git 存储库“落后”并要求合并?
- java - 在方法中使用日志跟踪方法的执行是不好的做法?
- java - Gradle for Android 的问题 -> Android Studio 请求添加元数据,但它不起作用
- c++ - blinn phong 照明产生奇怪的结果
- javascript - 反应 onLoad img 事件未按预期工作
- image - Woocommerce 使用缩略图问题子店面主题
- python - 从文件中总结价格,然后打印并附加总值
- r - R:Kruskal-Wallis 测试循环遍历数据框中的指定列
- css - CSS 网格,网格单元的自动填充和自动调整大小