angular-cli: ng serve --watch is not watching for code changes

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.4.9 node: 8.9.0 os: linux x64 @angular/animations: 4.3.6 @angular/common: 4.3.6 @angular/compiler: 4.3.6 @angular/core: 4.3.6 @angular/forms: 4.3.6 @angular/http: 4.3.6 @angular/platform-browser: 4.3.6 @angular/platform-browser-dynamic: 4.3.6 @angular/router: 4.3.6 @angular/cli: 1.4.9 @angular/compiler-cli: 4.3.6 @angular/language-service: 4.3.6 typescript: 2.3.4

Repro steps.

ng serve --port 8080 --watch

The log given by the failure.

The development server is not reloading when changes are made on the code… It only compiles and serves the project.

I don’t know what other information can I supply in order to explain better myself!

About this issue

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

Commits related to this issue

Most upvoted comments

Hi all, This may help if it is the same problem I had. Trying to use ng serve and ng build --watch sometimes worked but mostly they were not watching for code changes and I thought it was something to do with ng.

Then I remembered a problem I had a while back with inotify watches

I ran this on my Ubuntu machine and it seems to have kicked in and watching code changes:

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

Hope it helps

I am just realizing that using ng serve with sudo is making it work properly

Below cmd is working for me

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