ts file change not detected by NG Live Development

2019-09-13 02:21发布

问题:

Just playing with Angular CLI.

Here is what I did:

  1. npm install -g angular-cli
  2. ng new PROJECT_NAME
  3. cd PROJECT_NAME
  4. ng serve
  5. hit the page at: http://localhost:4200/ in browser
  6. change app.component.ts file, no change in browser
  7. change app.component.html file, new change is automatically reflected in browser

What is that my change in ts file not detected?

回答1:

This seems to be a problem with webpack 1.2.5. Rolling back one version worked for me.

Just run:

npm install --save @ngtools/webpack@1.2.4

You can read more about this issue here:

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



回答2:

You should install angular cli using:

npm install -g @angular/cli

and not:

npm install -g angular-cli

Make sure you're using the latest version and if not, update your Angular CLI to the latest version.

If you have still change detection issue, using the following solved the issue for me (on Ubuntu):

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



标签: angular