ng serve not detecting file changes
Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) ubuntu 16.04
- Versions. Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here: angular-cli: 1.0.0-beta.16 node: 6.6.0 os: linux x64 - Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. created new project nothing changed only changed the title
- The log given by the failure. Normally this include a stack trace and some more information.
- Mention any other details that might be useful.
While updating the source files the build is not auto updating the app
Thanks! We'll be in touch soon.
I face the very same issue except that my angular-cli version is 1.0.0-beta.15. It used to work in a previous version on the same computer
Same here on OS: Windows 10 angular-cli: 1.0.0-beta.16 node: 6.6.0
Maybe a duplicate of #2356 - does the path to your project folders include a space?
@bonnici no the path doesn't have any space or special character. The path is /home/harilal/works/ng2/routing/
To my wonder after removing global angular-cli and removing the nod-modules and reinstalling after cleaning the cache it worked. I need to check whether it will work next time.
At my side, I found the issue: the system that detects changes (inotify) can't handle so much watches by default.
To change the amount of watches it can handle (=the maximum amount of files that will be in the project) you must run this command:
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
The problem with inotify is reseting this counter every time you restart your computer.
In the previous version, there was an alert to tell that the whole project couldn't be observed. So we knew we had to run this command. It's not the case anymore.
Something, somehow, somewhere should be done so that this file detection always works out of the box on linux.
@paillave I think that's solved my issue. Now the project files gets compiled and it's updating. But i need to check after restarting the system. Last time when i reinstalled the angular-cli it's worked. BUt next day it's stopped working. I will update the issue once i have tested that also.
@harilalinapp out of angular 2 app, many have the same issue with inotify, especially on ubuntu: http://askubuntu.com/questions/716431/inotify-max-user-watches-value-resets-on-reboot-how-to-change-it-permanently, Here is the solution... (dunno it this actually works): https://bbs.archlinux.org/viewtopic.php?id=193020 or https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
@paillave Thanks for the support. I have to run the command each time at restart. Anyway it's works thanks.
Thank you @paillave seems to be an issue on Ubuntu and the fix is
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
as highlighted on https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
Closed in favor of https://github.com/angular/angular-cli/issues/1610, linking @paillave's solution there.
just remove spaces and special characters from all root directories of project directory(inclusive).
@paillave thank you, works fine!!
Same issue, Angular CLI : 1.0.0-beta.28.3 Node: 7.5.0 OS : Win32 x64
No spaces to app .. here's the path : c:\dev\myapp
I reinstalled node and angular a couple of time but nothing worked.
I am having a similar issue. Changing a .html file works fine. Changing a .ts file, the compiler fires but on reload there is no change.
Same here as @raducostea when .ts file is changed, the compiler fires, but the Hash (in terminal) is the same as before file change. I use Webstorm 2016.3.3 on Win 7 x64. Also tried to reinstall, set new project.
Same as https://github.com/angular/angular-cli/issues/4338
The same happens to me, the html takes the changes but the .ts does not
I think problem is in WebStorm. Webpack watch doesn't work if the file is not saved directly. Please try turning 'Safe write' option ( Settings | Appearance & Behavior | System Settings | Use "safe write" (save changes to temporary file first)) off. After this change all works fine for me.
It is a bug in the latest CLI. Execute the following command in your project folder: npm install --save @ngtools/[email protected] and ng serve
And it should work fine
@toni8810 , thank you!