angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng serve not detecting file changes

Open harilalinapp opened this issue 10 years ago • 59 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) ubuntu 16.04
  2. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here: angular-cli: 1.0.0-beta.16 node: 6.6.0 os: linux x64
  3. 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
  4. The log given by the failure. Normally this include a stack trace and some more information.
  5. 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.

harilalinapp avatar Sep 28 '16 10:09 harilalinapp

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

paillave avatar Sep 28 '16 13:09 paillave

Same here on OS: Windows 10 angular-cli: 1.0.0-beta.16 node: 6.6.0

dagilleland avatar Sep 28 '16 17:09 dagilleland

Maybe a duplicate of #2356 - does the path to your project folders include a space?

bonnici avatar Sep 28 '16 22:09 bonnici

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

harilalinapp avatar Sep 29 '16 03:09 harilalinapp

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 avatar Oct 02 '16 10:10 paillave

@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 avatar Oct 03 '16 04:10 harilalinapp

@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 avatar Oct 03 '16 05:10 paillave

@paillave Thanks for the support. I have to run the command each time at restart. Anyway it's works thanks.

harilalinapp avatar Oct 05 '16 04:10 harilalinapp

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

ridly avatar Oct 06 '16 00:10 ridly

Closed in favor of https://github.com/angular/angular-cli/issues/1610, linking @paillave's solution there.

filipesilva avatar Oct 06 '16 15:10 filipesilva

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

TheCodonist avatar Dec 17 '16 09:12 TheCodonist

@paillave thank you, works fine!!

llstarscreamll avatar Jan 17 '17 22:01 llstarscreamll

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.

shoaib0077 avatar Feb 02 '17 17:02 shoaib0077

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.

raducostea avatar Feb 03 '17 09:02 raducostea

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.

Kaspis77 avatar Feb 03 '17 09:02 Kaspis77

Same as https://github.com/angular/angular-cli/issues/4338

raducostea avatar Feb 03 '17 10:02 raducostea

The same happens to me, the html takes the changes but the .ts does not

rodrigoEclipsa avatar Feb 03 '17 19:02 rodrigoEclipsa

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.

titanoz avatar Feb 04 '17 12:02 titanoz

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 avatar Feb 04 '17 13:02 toni8810

@toni8810 , thank you!

oosor avatar Feb 04 '17 18:02 oosor