angular-cli: "ng serve" live development does not detect file changes

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

Output from: ng --version.

@angular/cli: 1.4.9
node: 8.7.0
os: linux x64
@angular/animations: 4.4.6
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.5.3

Repro steps.

Newest ng version 1.4.9 does not detect file changes. When switching back to recent version (1.2.6), everything works as desired. Recent version:

@angular/cli: 1.2.6
node: 8.7.0
os: linux x64
@angular/animations: 4.3.2
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.3.2
@angular/compiler: 4.3.2
@angular/core: 4.3.2
@angular/forms: 4.3.2
@angular/http: 4.3.2
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.3.2
@angular/platform-browser-dynamic: 4.3.2
@angular/router: 4.3.2
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.2
@angular/language-service: 4.3.2

The log given by the failure.

Desired functionality.

rebundling if file changes

Mention any other details that might be useful.

ng version 1.4.9 prints the following warning (but appplication itself is working without problems) Using this version can result in undefined behaviour and difficult to debug problems.

Please run the following command to install a compatible version of TypeScript.

    npm install typescript@'>=2.1.0 <2.4.0'

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 23 (3 by maintainers)

Most upvoted comments

I solved this issue from this link.

https://stackoverflow.com/questions/48092880/ng-serve-not-detecting-file-changes-automatically

I needed to use sudo ng serve.

The problem happened after I upgraded to ng cli 1.6.3 and package manager to yarn. I don’t know which actually was the cause. I’m just guessing one of above may have created files in privileged folder. So, with just ng serve cannot detect file changes there.

also ng serve --poll=2000 works

and echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p works too

@filipesilva, I have the problem again with newest version v1.4.9. No file changes are detected (I try several files). Now I have checked #1610 and did increase fs.inotify.max_user_watches (I am working on Ubuntu 16.04 system) with:

sudo echo 131072 >> /proc/sys/fs/inotify/max_user_watches

After restarting ng serve file changes are detected. I will leave this issue open at the moment, looking if that is really all to do…

This worked for me on ubuntu 16.04 sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p --system

The problem was related with Inotify Watches Limit on Linux. I increased the watches limit to 512K.

sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p --system

Angular CLI: 1.5.0 Node: 8.2.1 OS: linux x64 Angular: 5.0.1

Using sudo ng serve, it’s working for me now.

I know this may sound weird, but I solved it by stop using vscode workspaces, I was using it and serving the angular application using the integrated terminal, when I opened up only my project folder, it worked again.

for people who use Windows the command ng serve --poll = 2000 works too. except that I noticed a slowness in the build level after applying this person have any idea ?

Same here : Angular CLI: 1.6.5 Node: 8.9.4 OS: linux x64 (Ubuntu 17.01) Angular: 5.2.1 Workarounds like : sudo ng serve and ng serve --poll=2000 work fine

@ManfredSteiner could it be due to #8022 ?