因為本地希望開啟兩個項目,由于@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",
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持錯新站長站。
新聞熱點
疑難解答
圖片精選