Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot terminate the dev server process with Ctrl+C while running nx serve <app-name> #3348

Closed
vlodko opened this issue Jul 16, 2020 · 24 comments

Comments

@vlodko
Copy link

vlodko commented Jul 16, 2020

Steps to Reproduce

  1. Start dev server using nx serve <app-name> in Zsh or Bash
  2. Server starts on port:4200
  3. Use Ctrl+C to stop the process

Current Behavior

  1. 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

  1. 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
@FrozenPandaz
Copy link
Collaborator

FrozenPandaz commented Jul 21, 2020

This issue should be fixed with Nx 10 in #3330.

We plan on backporting this fix to v9.6 as well if you can't update right away.

Can you please try with Nx 10 to see if the issue is resolved there please?

@FrozenPandaz FrozenPandaz added blocked: retry with latest Retry with latest release or head. scope: core core nx functionality labels Jul 21, 2020
@vsavkin vsavkin removed the blocked: retry with latest Retry with latest release or head. label Jul 22, 2020
@vsavkin vsavkin self-assigned this Jul 22, 2020
@vsavkin
Copy link
Member

vsavkin commented Jul 22, 2020

@vlodko what version of Node are you using? Also, could you provide a repo with a repro?

@vlodko
Copy link
Author

vlodko commented Aug 10, 2020

thanks @FrozenPandaz @vsavkin
I'm using node v12.16.3.
Sorry, we haven't migrated to Angular 10 and Nx 10 yet, so I can't verify the fix as of now.

@vsavkin
Copy link
Member

vsavkin commented Aug 13, 2020

@vlodko could you provide a repo with a repro using Nx 9.5.1?

@vsavkin
Copy link
Member

vsavkin commented Sep 3, 2020

The issue has been fixed in Nx 9.6 and Nx 10.1. I'm sorry it took so long to get this right.

@vsavkin vsavkin closed this as completed Sep 3, 2020
@vlodko
Copy link
Author

vlodko commented Sep 3, 2020

@vsavkin thank you!

@JKancel
Copy link

JKancel commented Jan 25, 2022

Hi @FrozenPandaz @vsavkin,

I'm still encounter this issue in my Nx + Nextjs project with following dependency: "@nrwl/next": "13.5.2"

@nurbashanghai
Copy link

nurbashanghai commented Jan 27, 2022

same here, no matter what app I serve, when I kill the process in the terminal the server is still running on the same port:

"@nrwl/cli": "13.4.4",
"@nrwl/cypress": "13.4.4",
"@nrwl/eslint-plugin-nx": "13.4.4",
"@nrwl/express": "13.4.4",
"@nrwl/jest": "13.4.4",
"@nrwl/node": "13.4.4",
"@nrwl/tao": "13.4.4",
"@nrwl/workspace": "13.4.4",

Может быть проблема в самом ноджс?

@keevcodes
Copy link

keevcodes commented Jan 27, 2022

Having this issue as well with v13.5.2. Running a Nextjs app and despite terminating the process, the port is still running

@cwilliamson226
Copy link

I'm seeing this as well with 13.5.1, would love to figure out some kind of fix

@iwarner
Copy link

iwarner commented May 23, 2022

Still present also in 13.5.2

[ ready ] on http://localhost:4200
error - uncaughtException: Error: listen EADDRINUSE: address already in use :::4200

@jacobkellas
Copy link

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?

@adam-marshall
Copy link

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.

@eddsaura
Copy link

Same error here.

@urosdragojevic
Copy link

Noticed the same error.

@STih07
Copy link

STih07 commented Oct 11, 2022

Same thing

nx --version
14.8.3

node -v
v14.20.0

OS: MacOS Monterey 12.2.1 (Intel based)

Please, reopen

@goofiw
Copy link

goofiw commented Oct 20, 2022

This is happening to us as well on nx version 14.7.6 and node v16.14.0

@exsesx
Copy link

exsesx commented Oct 20, 2022

This also occurs on nx version 15, and the node version doesn't really matter, IG.

@chicken-suop
Copy link

@vsavkin This is still happening

@Flip-Liquid
Copy link

@vsavkin @FrozenPandaz
still happening in nx v 14.7.13 node v 16.10.0

@t18n
Copy link

t18n commented Nov 16, 2022

Mine was caused by version mismatching between the monorepos. Try to update all the nrwl/next packages to the same version :)

@goofiw
Copy link

goofiw commented Nov 16, 2022

@turboninh I'm not sure what you mean - do you have multiple nx monorepos?

We do not use a globally installed version of nx when running generators and commands. i.e. something like yarn nx serve api so it should only be using the locally install version in the package json of @nrwl/next

@julienboulay
Copy link

This bug occurs for me with nx 14.8.3 when upgrading node from 16.17.1 to 16.18.1.
I use n to manage node version.
I switched back to 16.17.1 and then 16.18.1, and now, Ctrl+C is working as before

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests