angular-cli: ng build and ng serve not detecting file changes

Ubuntu 16.04 angular-cli: 1.0.0-beta.15 node: 6.6.0 os: linux x64 watchman: 4.7.0

Run either ng build --watch or ng serve. Change any file inside of src, no changes detected.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 13
  • Comments: 31 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I faced with the same problem on Ubuntu 16.04 and angular CLI 1.0.0-beta.30

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

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

After that I restarted my IDE (WebStorm in my case) and after that the change detection started to work.

For those who use windows:

It is a bug in the latest CLI. Execute the following command in your project folder: “npm install --save @ngtools/webpack@1.2.4” and npm start or ng serve.

And it should work fine

hello guys, this problem was related to Inotify Watches limit on Linux. this command run and issue is solved,

cho 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

and run ng serve or ng build. And it should work fine

Anyone finding this on Google:

I encountered this issue on Ubuntu 16.04 with Angular/cli 1.0.3 while using Sublime Text 3.

From reading @RPGillespie6 comment, I close all my instances of Sublime Text, ctrl + c on running ng serve. Restart ng serve and reopen Sublime Text. I modify a file and save and everything works fine.

Before closing out Sublime Text I had tried restarting ng serve multiple attempts did not fix the problem.

sudo ng serve works!

I had the same issue working on Vagrant vm on Ubuntu 16.04 LTS.

Angular CLI: 6.0.8
Node: 11.10.0
OS: linux x64
Angular: 6.1.7

I tried all solutions, increasing notify watches, using --watch reinstalling npm and node. Nothing worked. This is what solved it for me. adding --poll=2000 like so:

ng serve --poll=2000 --host 0.0.0.0

@ulymor Thank you, your comment helped me find the root issue. Apparently Sublime 3 has a known bug that uses up all of the inotify watches. Once I closed Sublime, suddenly ng serve started working properly again.

just remove spaces and special characters from all root directories of project directory(inclusive).

Increasing inotify watches and restarting ng serve did not help me.

Ubuntu 18.04 with Angular CLI(7.3.7).

“echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches” works for me as @piyarulps suggested.

I’m using agular cli to create and serve a project, after editing a file it doesnot auto update the server, i have to restart the ng serve again.

I tried ng serve and ng build --watch , both not working

re install npm install , also i checked the folder names but still not working

sudo ng serve works!

Works me to…

Reporting that this is still an issue with @angular/cli: 1.7.4 on Windows 10. In my case I need to close Visual Studio Code for the changes to get picked up in the build.

Angular CLI: 1.7.4 Node: 8.9.4 OS: win32 x64 Angular: 5.2.10 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router

@angular/cli: 1.7.4 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.5.3 webpack: 3.11.0

when i am using ng -v: i am getting this: Mg++ version: Mg++ 1.5beta1 (formerly MicroGnuEmacs Adv.) and ng serve; -----Mg: serve (fundamental)----All------------------

what i need to do to work ng serve ?

I noticed when i make a new project in a folder containing white spaces in the name/path some files are missing in node-modules (970 folders)and auto update doesn’t work. When creating a project in a folder without white spaces everything works fine, node-modules(978 folders). (This is on Linux mint).