我在package.json
中有一些脚本,我需要知道如何使start
脚本正确接受angular-cli的-port
参数。
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
我们需要这个是因为我们想要同时运行多个软件实例。目前,如果我有一个项目在默认端口 4200 上运行,并尝试在第二个终端窗口中运行 npm start -port 4300
,我会收到“端口 4200 已在使用中。使用 '--port' 来指定一个不同的端口。”的提示。
我该怎么做才能让我的构建在特定端口上运行?以及如何使得我可以从命令行传递端口号到 npm start 脚本中?
-port
和--port
是两个不同的东西。检查拼写错误。 - tadman