angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng serve stop watching changes after an error in typescript file

Open sadokmtir opened this issue 9 years ago • 14 comments

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.

sadokmtir avatar Oct 12 '17 09:10 sadokmtir

This is unintended and I will investigate.

filipesilva avatar Oct 12 '17 10:10 filipesilva

:))) 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.

hiepxanh avatar Oct 12 '17 10:10 hiepxanh

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

filipesilva avatar Oct 12 '17 10:10 filipesilva

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

WindSaber avatar Oct 12 '17 20:10 WindSaber

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

jltwoo avatar Oct 14 '17 02:10 jltwoo

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

gooor avatar Oct 18 '17 10:10 gooor

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 avatar Oct 18 '17 11:10 filipesilva

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

cub avatar Oct 18 '17 14:10 cub

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

maartenmensink avatar Oct 19 '17 08:10 maartenmensink

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

ghost avatar Oct 19 '17 10:10 ghost

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.

bmayen avatar Oct 20 '17 01:10 bmayen

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.

aatkin avatar Oct 25 '17 10:10 aatkin

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.

ghost avatar Oct 26 '17 06:10 ghost

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.