Vijay V.
Vijay V.

Reputation: 566

Angular4 is not refreshing the page after code change

When i changed the code in Angular4 then page is not refreshing. i have to again start the server using

ng serve --open

Every time i change I have to restart the server.

Please guide me!

Is there any other option to avoid this?

Upvotes: 1

Views: 4383

Answers (5)

mrOak
mrOak

Reputation: 373

It's always a good idea to check that you are running the command on the right directory. Even if you are running ng serve on an in-project IDE Command line, it could've changed and you might not have realized it.

directory\your-project-folder> ng serve

and not

directory\other-folder-project> ng serve

Upvotes: 0

Pramod kushwaha
Pramod kushwaha

Reputation: 449

try below command in your angular root folder

ng server --watch 

Upvotes: 2

Naresh Singh
Naresh Singh

Reputation: 19

In Ubuntu run this command when your Angular page does not detect changes.

 echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

Upvotes: -1

Vignesh
Vignesh

Reputation: 1212

try

ng serve --open --watch

if this does not work try cache clean and npm install

If you are using Ubuntu Try reseting the number of watches this might solve the problem

echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

Upvotes: 3

Manu
Manu

Reputation: 10934

As mentioned in a similar answer here, try deleting your node_modules folder and running npm install again. This should upgrade a bad npm dependency.

I would recommend deleting cache as well, follow below steps:

  1. Delete node_modules folder.
  2. npm cache clean.
  3. npm install.

Since you are using a relatively older version of CLI, it would be better to update that as well!

Upvotes: -1

Related Questions