报错:Port 4200 is already in use. Use '--port' to specify a different port.
因为4200端口已被使用,请使用“--port”修改不同的端口号。
方法1:命令
直接使用命令:ng serve --port 4201
或简写:ng serve -p 4201
方法2:修改属性
在目录下node_modules/@angular/cli/lib/config/schema.json
搜索port,
收到以下代码:
"port": {
"description": "The port the application will be served on.",
"type": "number",
"default": 4200
},
然后把4200改为你想要的端口号,如:
"port": {
"description": "The port the application will be served on.",
"type": "number",
"default": 4201
},
然后ng serve