question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23

github_iconTop GitHub Comments

13reactions
JKancelcommented, 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"

4reactions
goofiwcommented, Oct 20, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Project Configuration - Nx
{ "name": "mylib", "scripts": { "test": "jest", "build": "tsc -p tsconfig.lib.json", // the actual command here is arbitrary "ignored": "exit 1" }, "nx":...
Read more >
How to Deploy, Manage and Scale Node.js Apps with PM2
Go ahead and start the server for your application in development mode using the command below. Ensure to kill the previous instance with...
Read more >
Failed to create nx workspace - node.js - Stack Overflow
I am facing the same issue for resolving use below command for creating new workspace:- npx create-nx-workspace --preset=angular ...
Read more >
Cisco MDS 9000 Series Command Reference - Show ...
Configures the default accounting method. show aaa authentication. To display configured authentication information, use the show ...
Read more >
Introduction to building an Angular app with Nx Workspace
For example, an API change might need to be reflected both on a server app and a client app. With monorepo, all of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found