Angular 提供了配置文件用来更改基本的配置,在根文件夹下的 package.json 文件
该文件中, “scripts” 对象的初始值是:
"scripts": {"ng": "ng","start": "ng serve","build": "ng build","test": "ng test","lint": "ng lint","e2e": "ng e2e"},
这里有一个 “start” 属性,更改这里的值:
"scripts": {"ng": "ng","start": "ng serve --port 4203","build": "ng build --prod","test": "ng test","lint": "ng lint","e2e": "ng e2e"},
然后在终端里输入命令npm start 就能编译通过并且在浏览器中顺利打开了。
