详解@angular/cli 改变默认启动端口两种方式

时在中春,阳和方起。阳和:春天的暖气。有时候,所有风景只为一个路人,或一个路过的人。一如那最初的爱情。

因为本地希望开启两个项目,由于@angular/cli 生成项目默认是: 4200; 那么肯定会有端口冲突问题;

修改端口的两种方式:

1 修改 schema.json

node_modules\@angular-devkit\build-angular\src\dev-server\schema.json
{
 "title": "Dev Server Target",
 "description": "Dev Server target options for Build Facade.",
 "type": "object",
 "properties": {
 "browserTarget": {
 "type": "string",
 "description": "Target to serve."
 },
 "port": {
 "type": "number",
 "description": "Port to listen on.",
 "default": *4200*
 },
 "host": {
 "type": "string",
 "description": "Host to listen on.",
 "default": "localhost"
 },
 "proxyConfig": {
 "type": "string",
 "description": "Proxy configuration file."
 },
 ...
 ...
 }
}

2 第二种方式通过 --port 方式 package.json中修改

"start": "ng serve --port 5200",

以上就是详解@angular/cli 改变默认启动端口两种方式。做有用的事,说勇敢的话,想美好的事,睡安稳的觉,把时间用在进步上,而不是抱怨上。更多关于详解@angular/cli 改变默认启动端口两种方式请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
JS获取鼠标点击时的位置

vue、nginx部署后刷新报404错误的解决方法

electron-builder配置项

VUE聊天页面自动滚动到底部

VUE CTRL+ENTER换行,ENTER发送消息