nx: Cannot terminate the dev server process with `Ctrl+C` while running `nx serve `
Steps to Reproduce
- Start dev server using
nx serve <app-name>in Zsh or Bash - Server starts on port:4200
- Use Ctrl+C to stop the process
Current Behavior
- The server is still running on the same port. When you try to start the dev server again the following error appears:
[error] Error: Port 4200 is already in use. Use '--port' to specify a different port.
at Server.<anonymous> (......./node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/check-port.js:27:28)
at Object.onceWrapper (events.js:417:26)
at Server.emit (events.js:310:20)
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Note: using ng serve <app-name> works as expected
Expected Behavior
- The process is terminated after pressing Ctrl+C When you start a server again the port is available for use
Environment
OS: macOS Shell: Zsh, Bash
nx report:
@nrwl/angular : 9.5.1
@nrwl/cli : 9.5.1
@nrwl/cypress : 9.5.1
@nrwl/jest : 9.5.1
@nrwl/tao : 9.5.1
@nrwl/workspace : 9.5.1
typescript : 3.8.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (3 by maintainers)
Hi @FrozenPandaz @vsavkin,
I’m still encounter this issue in my Nx + Nextjs project with following dependency:
"@nrwl/next": "13.5.2"This is happening to us as well on nx version 14.7.6 and node v16.14.0
Same thing
OS: MacOS Monterey 12.2.1 (Intel based)
Please, reopen
@vsavkin This is still happening
this has started happening for me since upgrading from
"@nrwl/cli": "14.3.6"to"@nrwl/cli": "14.7.8".It was fine on 14.3.
NX 14.7.5 I’ve run my server on localhost:8080 and now no matter what I do I can’t use that port. It still tries to serve up that application. I’ve killed every PID resembling 8080 and they come back. Shut down my machine and it still tries to serve the app. Any tips?
I’m seeing this as well with
13.5.1, would love to figure out some kind of fixNoticed the same error.
Same error here.
Still present also in 13.5.2
[ ready ] on http://localhost:4200 error - uncaughtException: Error: listen EADDRINUSE: address already in use :::4200
Having this issue as well with v13.5.2. Running a Nextjs app and despite terminating the process, the port is still running
The issue has been fixed in Nx 9.6 and Nx 10.1. I’m sorry it took so long to get this right.