Open
Description
如歌换个端口启动项目?
我想在 6666 端口启动项目
- 方法一:在启动的时候添加参数
ng server --port 6666
- 方法二:修改配置文件,然后直接 ng server
在依赖包中找到@angular/cli/lib/config/schema.json,在523行或者直接搜索'port'在它键为default的地方填入 6666
"serve": {
...
"port": {
"description": "The port the application will be served on.",
"type": "number",
"default": 6666
}
}
如果你是用脚手架自动生成的项目,并且要用jasmine做单元测试的话,还需要做一步:找到protractor.conf.js文件把‘baseUrl’也改成新端口,让测试代码在改过的端口运行。