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

Ctrl + C is not working dev-server with SSR #28336

Closed
1 task done
helloaliimran opened this issue Sep 3, 2024 · 7 comments · Fixed by #28604
Closed
1 task done

Ctrl + C is not working dev-server with SSR #28336

helloaliimran opened this issue Sep 3, 2024 · 7 comments · Fixed by #28604

Comments

@helloaliimran
Copy link

helloaliimran commented Sep 3, 2024

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17

Description

The Ctrl+C command is not working to stop the application from the terminal.

Minimal Reproduction

I face this problem after updating angular material : ng update @angular/material

Exception or Error

No response

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 18.2.2
Node: 20.11.1
Package Manager: npm 9.8.1
OS: win32 x64

Angular: 18.2.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... platform-server, router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.2
@angular-devkit/build-angular   18.2.2
@angular-devkit/core            18.2.2
@angular-devkit/schematics      18.2.2
@schematics/angular             18.2.2
rxjs                            7.8.1
typescript                      5.4.3
zone.js                         0.14.10

Anything else relevant?

No response

@alan-agius4
Copy link
Collaborator

Are you using the vite based dev-server with ssr?

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Sep 3, 2024
@helloaliimran
Copy link
Author

vite based dev-server

no I am using simple VS Code compiler, and yes SSR is enable.

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @angular/build angular/build:dev-server and removed needs: more info Reporter must clarify the issue labels Sep 3, 2024
@alan-agius4
Copy link
Collaborator

I'm not entirely sure what you mean by "VS Code compiler" in this context. You can either be using the Webpack or Vite based dev-server. Given that you're using SSR and encountering this issue, it's probable that you're working with the Vite dev server.

This is a known issue in this case, and is appears to be caused zone.js. As a workaround, you can use q + <enter>.

//cc @JiaLiPassion

@alan-agius4 alan-agius4 changed the title Ctrl + C is not working Ctrl + C is not working dev-server with SSR Sep 3, 2024
@anisabboud
Copy link

Encountering the same issue for the past couple of weeks... (Angular 18.2 with Vite/SSR, WSL shell)
ng serve => Ctrl + C sometimes works, and oftentimes stops working; especially when there's a console log.

Reproduction

  1. app.component.tsconstructor() { console.log('hello'); }
  2. ng serve
  3. Navigate to http://localhost:4200
  4. hello will be printed to the terminal, and after that Ctrl + C doesn't work
    image

Workarounds

Ctrl + D or q + <enter> work.

@zygarios
Copy link

I have the same problem

@kuncevic
Copy link

kuncevic commented Oct 7, 2024

same problem here, initially thought taking place only in vs code but however same using external terminal.
If you just serve and then ctrl+c all works, tho breaks after you console.log

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Oct 9, 2024
This commit provides a workaround for angular#28336, which occurs due to the interaction between `zone.js` and `listr2`. The issue prevents proper termination of the development server using Ctrl + C when dev-server.

Closes: angular#28336
alan-agius4 added a commit that referenced this issue Oct 9, 2024
This commit provides a workaround for #28336, which occurs due to the interaction between `zone.js` and `listr2`. The issue prevents proper termination of the development server using Ctrl + C when dev-server.

Closes: #28336
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Oct 9, 2024
This commit provides a workaround for angular#28336, which occurs due to the interaction between `zone.js` and `listr2`. The issue prevents proper termination of the development server using Ctrl + C when dev-server.

Closes: angular#28336
alan-agius4 added a commit that referenced this issue Oct 9, 2024
This commit provides a workaround for #28336, which occurs due to the interaction between `zone.js` and `listr2`. The issue prevents proper termination of the development server using Ctrl + C when dev-server.

Closes: #28336
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@kuncevic @anisabboud @helloaliimran @alan-agius4 @zygarios and others