webpack live reload is not working.
I have installed the webpack but the live reload is not working , it is building the modules and caching it.
Linux 4.4.0-31-generic node v6.2.2 npm v3.10.5
angular-cli: 1.0.0-beta.11-webpack node: 6.2.2 os: linux x64
npm install --save @ngtools/[email protected] this works @rafaell-lycan give it a try
@challe try uninstall beta 26 install beta 30 npm install -g @angular/[email protected] install ngtools 1.2.7 npm install --save @ngtools/[email protected]
this to works for me
thanks man @miguelcaravantes, u saved my day.
Some problem here in Archlinux with a fresh installation via angular-cli, I solved it changing the fs.inotify.max_user_watches, also I remember to have this problem previously angular-cli with gulp-watch but at this time I had an error message, so it was easy to figure what was going on.
To change it in archlinux follow these steps:
# Add this line to /usr/lib/sysctl.d/50-default.conf
/usr/lib/sysctl.d/50-default.conf
# Reload all system configurations
sudo sysctl --system
max_user_watches setting doesn't fix my problem. At first change it reloads well but after first it doesn't reload. Totally it's an file system cache issue. After I drop the page cache it works well.
sync;echo 1 > /proc/sys/vm/drop_caches;sync
edit:
just sync works too. No need for drop_caches. Use sync after all save operation.
Same problem for me on Ubuntu 14.04 LTS, node: 6.9.2, I tried angular-cli 1.0.0-beta.28.3 / 1.0.0-beta.30 / 1.0.0-beta.31, and I tried the suggestions of this thread... Nothing worked to solve the problem...
@sancaruso [email protected], angular/cli and 1.0.0-beta.31 and chrome browser fixed my issue.
With [email protected], angular/cli 1.0.0-beta.31 and chrome browser it doesn't work for me.
Oh! I found the problem... In fact I had a folder with parenthesis in the path of my project, but it was hidden by a symbolic link...
Awesome @dmikhaylov . Adding poll : true solved the problem.
max_user_watches fix doesn't work for me, and I tried using npm install @ngtools/[email protected] as suggested in linked issues and then my project wouldn't even compile - I assume because I have @angular/cli rc.0 and it is too new for the older version of ngtools/webpack.
I don't have any spaces or parenthesis or + in path names, what can I try now?
ng serve --poll=2000
@alexsaraiva That did the trick for me, thanks a lot!
@filipesilva The inotify fix will not work in all cases. I recently ran into this issue and no matter how high I set the max, it did not fix it. I finally solved it when I figured out that Sublime Text 3 (popular text editor) was using up all available inotifies as soon as I created them. If I killed Sublime, suddenly ng serve was correctly watching files again. The Sublime bug is still open:
https://github.com/SublimeTextIssues/Core/issues/1195
I recommend adding a warning or error-level output to ng serve that lets you know that all inotifies are used up and file watching is unavailable. I can research and submit a PR for this if you think it would be worthwhile.
Hello, I have updated a project to angular 4, and i found this issue, in fact watcher is working, then compile is ok, but on the browser app remains on "loading..." with no console errors.
this my ng info:
@angular/cli: 1.0.0
node: 6.9.5
os: darwin x64
@angular/animations: 4.0.1
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/compiler-cli: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.3
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/platform-server: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
any suggestion?, Thanks.
Hello! I got the same problem. But it works fine with Sublime Text when you press CTRL+S , but in PHPStorm it stops to work after few clicks CTRL+S.
I am seeing spurious errors more along the lines of what @klmcwhirter describes: A change is being triggered, and the live reload refreshes in the browser, but the source changes are not reflected in the new page. This may be something as trivial as changing a string, and still seeing the old string shown after a refresh. This could either be compiling a wrong (cached) version of the file, or – more likely – serving a stale version.
I get the feeling we're seeing three different errors:
- Changes are not detected. This seems to be what the majority of this thread focuses on.
- Changes are detected, but a stale version still ends up in the browser after a refresh.
- Changes to footprint/interfaces are not correctly reloaded. (This seems to be quite consistent, and has some dedicated issue reports, but doesn't seem to be fully resolved).
@wulfsberg - what I observed could be explained by this (I have done this to myself years ago on UNIX):
- cd outDir
- rm -fr outDir/* outDir
- mkdir outDir
At this point outDir exists on the filesystem again (different inode) but so does the old one in the kernel (old inode that was removed from the parent dir). I suspect the main server process remains in the old outDir. This directory is empty. [ note in my example above I do not cd to a different dir after doing the deletes ]
What I cannot explain, however, is why the new outDir directory contains the contents of the old .js bundles.
I, too, suspect what @wulfsberg describes - old cached copy is placed into the new outDir instead of the newly compiled bundle(s). Although I cannot conceive of an implementation of ng server that would read the old bundles into memory, compile and build new bundles but then write out the old cached versions. That does not make sense to me. But it seems that indeed that is what is happening.
I cannot explain this by any technique that uses dir rename and recreate even if a rollback is performed. The new outDir has a different inode. So what I am seeing cannot be due to a dir renaming scheme.
I tested for and eliminated browser caching as a possibility (used chrome dev tools and turned cache off).
For now, I am just using ng build --watch. The issue may be fixed at this point. I simply haven't taken the time to find out.
@wulfsberg I'm currently facing the same issue with the recompile working but the browser still serving the previous version. E.g. when changing a HTML file ("a" => "abc") the devtools show the reload, the page even reloads but still displays "a". When doing another change to the same file ("abc" => "def") it again reloads but now shows the first change (displaying "abc").
Will investigate tomorrow, must be something with my setup which is an ng4-ejected, adapted config that worked well before ejecting and adapting it.
To follow up on @filipesilva's comment in https://github.com/angular/angular-cli/issues/5831#issue-299191668, it does seem likely that the spurious stale results are related to IntelliJ's "Safe write".
It looks as if the Angular-CLI triggers on the first change in the folder (the write of the new, yet-to-be-renamed file), and then throttles further changes, likely in anticipation of a couple more changes to timestamps etc., rather than debouncing the changes and picking up the final result of the barrage. -This is based on some experiences I have with file change detection in other contexts, not the Angular-CLI code and dependencies, so this is just me guessing wildly.