A inspection port should be other than 7777 for child process.
Child process using the port 7777 for inspect, which is using by parent process.
Starting inspector on localhost:7777 failed: address already in use
The repo containing minimal reproduction of issue: https://github.com/annsk/nx-fork-issue
angular.json configuration:PS C:\Sites\nx-fork-problem\nx-fork-issue> ng serve server
Starting type checking service...
Using 2 workers with 2048MB memory limit
Type checking in progress...
Hash: c407198eb3585492d041
Version: webpack 4.29.0
Time: 265ms
Built at: 2019-04-11 07:41:24
Asset Size Chunks Chunk Names
main.js 5.81 KiB main [emitted] main
main.js.map 4.74 KiB main [emitted] main
Entrypoint main = main.js main.js.map
[0] multi ./apps/server/src/main.ts 28 bytes {main} [built]
[./apps/server/src/main.ts] 509 bytes {main} [built]
[child_process] external "child_process" 42 bytes {main} [built]
[express] external "express" 42 bytes {main} [built]
Starting inspector on localhost:7777 failed: address already in use
No type errors found
Version: typescript 3.2.2
Time: 1834ms
A workaround if you can live without the inspector is to add a new configuration for your apps serve command in angular.json.
// find this for your app
"serve": {
"builder": "@nrwl/builders:node-execute",
"options": {
"buildTarget": "backend:build"
},
// add this
"configurations": {
"development": {
"inspect": false
}
}
},
Then launch your app: ng serve backend --configuration=development
@annsk Thanks for submitting the issue. I'm getting the following when running ng serve server in the provided repo:
Debugger listening on ws://localhost:7777/ad7a2352-b0cc-4fb4-aa99-f9ad43002705
For help, see: https://nodejs.org/en/docs/inspector
Listening at http://localhost:3333
Debugger listening on ws://localhost:7777/7beb70b0-3b29-43f6-b1f1-d7fe1ac5810e
For help, see: https://nodejs.org/en/docs/inspector
What version of node are you using?
NodeJS v9.8.0 running on Windows 10 1809.
I was able to repro the issue (only on Windows). You should be able to fix it, like this:
"serve": {
"builder": "@nrwl/builders:node-execute",
"options": {
"buildTarget": "server:build",
"port": 0
}
},
Port 0 will assign random free ports to all forked processes.
I think it should be an annotation about port 0 in the documentation.
@annsk would you like sending a PR updating the docs? It'd be awesome.
Updated the docs here: https://github.com/nrwl/nx/pull/1697
Closing this issue.
Most helpful comment
I was able to repro the issue (only on Windows). You should be able to fix it, like this:
Port 0 will assign random free ports to all forked processes.