angular-cli: rebuild with ng serve is not reliable

I’m using ng serve to get instant feedback while I’m developing but in some (unknown) situations the rebuilding isn’t reliable. Sometimes I’m getting compile errors that I’ve already fixed. If I restart ng serve then the errors don’t show up anymore. This worsens developer productivity a lot because I spend time to find an error in my code that doesn’t exist anymore until I remember to restart the build command.

OS?

Windows 8

Versions.

$ ng --version
@angular/cli: 1.0.0-rc.1
node: 7.1.0
os: win32 x64

Repro steps.

App was created using the CLI. I’m not able to reliable reproduce the problem. It sometimes happens and sometimes not. However, these are the steps I’m doing:

  1. ng serve
  2. write some code and rebuilding works fine
  3. write an error in the code that produces a compile error
  4. fix the code
  5. The code is rebuild as expected but the compile error still shows up.
  6. kill ng serve and restart it
  7. The code compiles just fine.

The log given by the failure.

No specific error message.

Mention any other details that might be useful.

I’ve used version 1.0.0-beta.24 for a long time without such problems. Only after I updated to 1.0.0-rc.1 the problem started to occur.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 27
  • Comments: 30

Commits related to this issue

Most upvoted comments

I think this should be reopened

still happens when I try to remove property from interface then errors doesn’t show until I use ng serve again

@angular/cli: 1.0.0 node: 6.10.0 os: darwin x64 @angular/common: 4.0.0 @angular/compiler: 4.0.0 @angular/core: 4.0.0 @angular/forms: 4.0.0 @angular/http: 4.0.0 @angular/platform-browser: 4.0.0 @angular/platform-browser-dynamic: 4.0.0 @angular/router: 4.0.0 @angular/cli: 1.0.0 @angular/compiler-cli: 4.0.0

@hansl

I can confirm that changes in interfaces are not picked up automatically in 1.0.0-rc.0, meaning I have to re-run “ng serve” manually whenever I change an interface.

Same issue here. Mostly encounter failure to rebuild after moving, or creating interfaces. The error message is “{file} has no exported member {Interface}”.

OS: Linux Mint 18.2 angular: 4.0.0 angular/cli; 1.2.1

Sometimes, when I save interface file on editor, compile errors are gone. But after saving other files, error occurs again.

Hi,

I have the same problem since 1.0.0-rc.1. But for me it appear (amost everytime) when I create/modify or delete an interface.

For exemple if I create a new interface (after the ng serve being launch), I have an error on the compilation, that says that the interface does not exsit. To fixe it I need to restart the ng serve.

The issue still persists. @angular/cli 1.7.4

I don’t know if this is related, but it sounds quite like it. When installing angular-cli, I get the following warning:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

fsevents very much sounds like it’s required to detect file changes and reinitiate the building process.

Or… how is that done on Windows?

Having the same problem. Sometimes when I make any changes to my .ts files (not just interfaces), rebuild is initiated, browser page is reloaded, but compiled code stays as if I didn’t make the latest change.

Windows 10 @angular/cli: 1.0.0 node: 7.2.0 os: win32 x64 @angular/common: 4.2.2 @angular/compiler: 4.2.2 @angular/core: 4.2.2 @angular/forms: 4.2.2 @angular/http: 4.2.2 @angular/platform-browser: 4.2.2 @angular/platform-browser-dynamic: 4.2.2 @angular/router: 4.2.2 @angular/cli: 1.0.0 @angular/compiler-cli: 4.2.2

My (rather awful) workaround is to initiate a rebuild by making some dummy changes and saving source file. If you’re using JetBrains IDEs, you can just add a whitespace anywhere and save file. IDE will remove unnecessary whitespace, but rebuild will still be initiated.

@BobBDE @adamdport I am also facing this when changing interfaces/tempaltes. Current “hack” to make it re-compile - you need to change code in the way that i will be different when compiled. For example add code ;+4; above or below interface, of inside the function, and hit Save- where it will not produce compilation error. Then remove it when you are finished changing of interface. This is ugly, but works faster than restart.

Yep this still happens to me too. Same versions as @rainstormza.