Skip to content

ng serve stop watching changes after an error in typescript file #8022

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

Closed
sadokmtir opened this issue Oct 12, 2017 · 14 comments · Fixed by #8203
Closed

ng serve stop watching changes after an error in typescript file #8022

sadokmtir opened this issue Oct 12, 2017 · 14 comments · Fixed by #8203
Assignees
Labels
freq4: critical Happens to many users every day needs: repro steps We cannot reproduce the issue with the information given P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix

Comments

@sadokmtir
Copy link

sadokmtir commented Oct 12, 2017

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.6
node: 6.10.3
os: win32 x64
@angular/animations: 4.4.4
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.6
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

Repro steps.

Make an error in ts file.
You get a message: webpack: Failed to compile.
Get rid of the error in the code.
ng serve does not rebuild automatically.

The log given by the failure.

ERROR in events.service.ts (13,21): Cannot find name 'Routerws'.
webpack: Failed to compile.

Desired functionality.

The ng serve should detect the fixes after an error and rebuild the app like always. For now, everytime, I have an error I need to kill the process with ctr+c and retype ng serve again.

@filipesilva filipesilva self-assigned this Oct 12, 2017
@filipesilva filipesilva added freq4: critical Happens to many users every day P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix labels Oct 12, 2017
@filipesilva
Copy link
Contributor

This is unintended and I will investigate.

@hiepxanh
Copy link
Contributor

:))) I thought this is a feature, I'm using angular cli 1.5 beta 4 and it have the same issue when I have 5 ERROR, If I fix some ERROR but not clear, it not rebuild, it only rebuild until I fix ALL 5 ERRORS and auto rebuild normally.
This is not bug, it is a new feature!
CLI is saving your resource, it only rebuild only when you fix all of your bug.

@filipesilva
Copy link
Contributor

@hiepxanh it is intended that builds fail while you have errors, but this report seems to show it will not rebuild even after the error is fixed.

@WindSaber
Copy link

Same issue here, but whith other version

@angular/cli: 1.4.5
node: 8.6.0
os: win32 x64
@angular/animations: 4.4.4
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.5
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

By the way I'm using webstorm 2017.2

@jltwoo
Copy link

jltwoo commented Oct 14, 2017

Have the same issue, very disruptive to my development time right now, and there are no leads to what may be causing this...

@angular/cli: 1.4.7
node: 6.10.0
os: linux x64
@angular/animations: 4.4.4
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

Using Sublime Text

@gooor
Copy link

gooor commented Oct 18, 2017

Have this problem on two projects
The way I reproduce this is:

  1. create new *.ts file
  2. import it anywhere
  3. make any changes (without errors) -> watcher will work
  4. make any TS error (const a:number = 'x';)
  5. save will rebuild and throw an error
  6. remove line with TS error -> watcher won't run
  7. comment out import from step 2 - rebuild will trigger, error will go away
  8. uncomment line from step 2 - rebuild will trigger and error from step 5 will appear again even if the line is not there anymore

Looks like new file is cached after an error - that's my guess

@angular/cli: 1.4.2 and 1.4.7
node: 6.10.0 and 8.5.0
os: OSX Sierra
@angular/common: 4.0.0. and 4.4.4
... @angular/.... 4.0.0 and 4.4.4
typescript: 2.2.0

@filipesilva
Copy link
Contributor

filipesilva commented Oct 18, 2017

Heya, I'm trying to reproduce using the instructions here, but I cannot see the behaviour you are reporting. This is what I did:

  • make a new project
  • ng serve
  • add console.log(1); to src/app.component.ts -> rebuild successful
  • add const a:number = 'x'; to src/app.component.ts -> rebuild failed
  • remove const a:number = 'x'; to src/app.component.ts -> rebuild successful
  • create src/file.ts, add export const myvar = 42; to it
  • add import { myvar } from './file'; console.log(myvar); to src/app.component.ts -> rebuild successful
  • add const a:number = 'x'; to src/file.ts -> rebuild failed
  • remove const a:number = 'x'; to src/file.ts -> rebuild successful

Anyone have an idea of what be missing in my testing?

These are my versions btw:

@angular/cli: 1.4.7
node: 6.11.1
os: win32 x64
@angular/animations: 4.4.5
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4

@filipesilva filipesilva added the needs: repro steps We cannot reproduce the issue with the information given label Oct 18, 2017
@cub
Copy link

cub commented Oct 18, 2017

Moving from @angular/* 4.4.4 to 4.4.5 seem's to fix the non recompilation after an error for me.
@angular/cli 1.4.7
node: 8.4.0
os: win10 x64

@maartenmensink
Copy link

I am experiencing the same behavior. I upgraded to the versions that @filipesilva posted sadly no difference. I have tested this across several clients projects we have all the same behavior. Once the build failed with webpack: Failed to compile then the watch stops. I do notice that it has to be a typescript error.

I add a invalid include path in a .scss file then fix that error it will trigger a rebuild.

@angular/cli: 1.4.7
node: 6.10.1
os: win32 x64
@angular/animations: 4.4.5
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4

@ghost
Copy link

ghost commented Oct 19, 2017

@filipesilva: I'm currently experiencing this when I get "Supplied parameters do not match any signature of call target." errors.

@bmayen
Copy link

bmayen commented Oct 20, 2017

I noticed this when the initial build fails. If initial build succeeds and there is an error on a subsequent build, fixing the error triggers a successful rebuild. But if there is an error on the initial build, fixing it will not trigger a rebuild.

@aatkin
Copy link

aatkin commented Oct 25, 2017

Getting this error as well, as @bmayen described. Annoying, since new builds from scratch can take a lot of time (26 seconds compared to incremental builds of ~1 second). Using angular-cli 1.4.9, Node 8.8.0 and command ng build --extract-css=true --watch --progress.

@ghost
Copy link

ghost commented Oct 26, 2017

This bug is really strange. I can reproduce it in our codebase by inserting Promise.resolve(true).then((a, b) => {}); somewhere; but when I try to reproduce it in a new (clean) project, even with the same package.json and tsconfig.json, it doesn't trigger the bug.

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq4: critical Happens to many users every day needs: repro steps We cannot reproduce the issue with the information given P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants