Angular/CLI — auto reload doesn't happen

后端 未结 11 1852
既然无缘
既然无缘 2020-12-24 13:06

I recently started working with Angular/CLI tool, I\'m facing a problem while executing the file, that is when I run

ng serve 

then this c

11条回答
  •  鱼传尺愫
    2020-12-24 13:21

    I also encountered the same problem a few days back in my linuxOS, and when I read about it, I found that this problem is heavily dependent on the system you use and the way you did your setup for angular-cli, both globally and locally. So, after reading readme.md created by angular-cli for each project, I tried using ng-build --watch but the problem still couldn't be solved because by running this command it should work like ng-serve but it only build the app and doesn't even served it on localhost:4200. then, after digging into the problem more deeper I found the problem, it was with my OS, I am using ubuntu, the inotify/max_user_watches value 8192, which I crossed, due to which it wasn't showing any changes made further. So i used these- echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf sudo sysctl -p and it worked fine.

    p.s. in the process i also tumbled upon a solution with these commands - rm -rf nodes_modules/ -> npm update -> npm install. try this before doing above stated canges, if this works for you then you are well and good to go.

提交回复
热议问题