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 command helps us in auto reloading the site when any changes are made in the source file but in my system it is not happening (i.e. site is not auto reloading and when I forcely reload the site then also it is not getting updated as per changes made in the source file).
The site is getting updated only when I terminate the "ng serve" command and again run the same command("ng serve") then only my site is getting updated.
So it becomes hard for me to terminate the server and connect the server, when ever the changes are made, so I request you people if any one know solution of this problem please help me out.
I have faced the same issue in my ubuntu machine. It was due to the permission settings. I changed the workspace permission settings by following the below mentioned steps.
sudo chmod a+rwx /path/to/file
into the terminal, replacing “/path/to/file” with the file you want to give permissions to everyone for, and press “Enter.” You can also use the commandsudo chmod -R a+rwx /path/to/folder
to give permissions to a folder and every file and folder inside it. Omit the “x” from either command if you don’t want the files to be executable.I have used
sudo chmod -R a+rwx /path/to/folder
.Once it is done, do
npm build
and start the application byng serve
.[OR]
Simply you can use "sudo ng serve".
Now do the necessary changes in the workspace files and without restart, auto-reload happens. Hope this would be helpful!
I am using angular 6 and increasing time on max_user_watches worked for me
sudo sysctl -p /etc/sysctl.conf
run ng serve with sudo, it worked for me
This is only for Linux!
If angular auto-reload is not working on ubuntu 20.04 and you are using nvm try running the following:
Hopefully when you run ng serve everything should work as expected now.
Ng serve automatically reload when the files are modified however if the config is messed up then you can try bellow command