1

Using ng serve the project runs in localhost but after changing the code it does not refresh.

Lets say we have the general "App Works!!" in the initial project. However, it doesn't change if I edit inside the application.component.ts the "App works" to "Hello". It still shows App Works!!

what's the problem. Help me out.

mast3rd3mon
  • 8,229
  • 2
  • 22
  • 46
sushil suthar
  • 639
  • 9
  • 12

3 Answers3

3

This is a bug within the latest @ngtools/webpack package that the angular-cli uses. To fix this you need to manually downgrade the package:

npm uninstall @ngtools/webpack
npm install --save-dev @ngtools/webpack@1.2.4

After a new cli version, you should remove this from your package.json again

For more information check this bug report

Poul Kruijt
  • 69,713
  • 12
  • 145
  • 149
1

The solution for Ubuntu webpack rebuild issue.

The problem seems to be the inotify max_user_watches :

sudo echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf

sudo sysctl -p /etc/sysctl.conf
abahet
  • 10,355
  • 4
  • 32
  • 23
  • Using >> in the command even after adding sudo might result in 'permission denied', to resolve this issue, follow this thread https://stackoverflow.com/questions/84882/sudo-echo-something-etc-privilegedfile-doesnt-work-is-there-an-alterna – Kartik Chauhan Mar 29 '18 at 16:41
1

Had the same problem with Ubuntu 16.04. Quick fix:

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

Hope this helps someone!

nwaweru
  • 1,723
  • 1
  • 13
  • 14