When I start ng serve server
on the command line it fails with:
Starting inspector on localhost:7777 failed: address already in use
This is expected, because there is really already another instance running.
So how can I change the inspector port for this instance?
I've tried to set the env-var NODE_OPTIONS
to
'--inspect=7888'
'--inspect=localhost:7888'
both had no effect: i.e. it was still failing with
Starting inspector on localhost:7777 failed: address already in use
Note:
I do NOT want to change the application port: e.g. ng serve --port 5600
- it's only about the node-inspector port
tldr;
Since ng serve server
uses nrwl/node:execute
I must use the nrwl port option:
ng serve server --port 7888
and not the ng serve port:
ng serve--port 7888server
Details:
When I start ng serve server
, then ng will
angular.json
file for the project server
architect
-serve
section is relevantin my case, this is
"serve": {
"builder": "@nrwl/node:execute",
"options": {
"buildTarget": "server:build"
}
}
Thus, ng
will just start the @nrwl/node:execute
bulder, which supports the option -port
So to summarize, there are 2 port options available
ng serve -port 5600 server -port 7888
5600
is the application port (which I need not chagne in this case)7888
is the inspector port, which I must change in this case