這篇文章將為大家詳細(xì)講解有關(guān)@angular/cli如何改變默認(rèn)啟動(dòng)端口,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
因?yàn)楸镜叵M_(kāi)啟兩個(gè)項(xiàng)目,由于@angular/cli 生成項(xiàng)目默認(rèn)是: 4200; 那么肯定會(huì)有端口沖突問(wèn)題;
修改端口的兩種方式:
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 第二種方式通過(guò) --port 方式 package.json中修改
"start": "ng serve --port 5200",
關(guān)于“@angular/cli如何改變默認(rèn)啟動(dòng)端口”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。