Angular-cli: rebuild with ng serve is not reliable

Created on 13 Mar 2017  路  30Comments  路  Source: angular/angular-cli

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.

1 (urgent) bufix

Most helpful comment

I think this should be reopened

All 30 comments

I'm also having issues with 1.0.0-rc.1, I want to see the diffs but I don't see a release for it https://github.com/angular/angular-cli/releases. 1.0.0-rc.0 is works fine.

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.

beta 32.3
happened to me too
when I try import library pdfmake

sometime error appear after I save the same code again , don't know why

Happens to me in beta-26

I have same problem with 1.0.0-rc.0

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.

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

Having the same or similar issue as the op. Changes to html and css files seem to get detected and update just fine but changes to classes, components, or interfaces get detected but the the in memory build doesn't seem to get updated from time to time until I fully restart ng serve.

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

Thx, when RC3 is coming?

Is there some sort of temporary workaround for this until the next rc comes along? Oh my bad... I'm assuming this should be in the 1.0.0 release?

I still see this very frequently... I've tried manually updating @ngtools/webpack as well as uninstaleld cli and re-installed. Probably 2-3 builds and then crtl+c to cancel serving only to restart

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

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

I am annoyed by this also, I found this while looking for a way to put the compiler in manual mode...

@hansl My team is still having issues with this at @1.1.1. Has your fix been released yet or should I open a new issue?

@adamdport
it happen when you change class or interface (model) right ?

@rainstormza
Hi,
I don't know for the classes but when I add or remove a attribut of an interface, I need to restart the server in order to make it work. If I don't I have a typescript error that blocked the compilation.

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

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.

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

Bug still exists. When is it going to be fixed? Pretty urgent in my book.

@angular/cli: 1.2.2
node: 6.11.1
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.2.2
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.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 [email protected]: 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?

In the meantime I've updated to @angular/cli-1.5.0-beta.4. Bug/strange behavior persists.

I use cli 1.4.6, this error still exists, it is a pain in the ass, I have to cancel the serve task and start it again, each time, I got an error in the code.

It looks like this was fixed in 1.4.7
Just installed "@angular/cli": "1.4.7" and webpack is now compiling after a 'Failed to compile' error.

I'm on Windows 10.

```
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",

"@angular/cli": "1.4.7",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",

```

Thx. Updated to 1.4.7 and it seems to be fixed :)

I still have this issue randomly with interfaces their signatures being updated. Using angular/cli ^1.4.8.

The issue still persists. @angular/cli 1.6.0. :(

I think this should be reopened

The issue still persists. @angular/cli 1.7.4

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwillmer picture rwillmer  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

sysmat picture sysmat  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

NCC1701M picture NCC1701M  路  3Comments