angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

webpack live reload is not working.

Open burdzand opened this issue 10 years ago • 100 comments

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

burdzand avatar Aug 09 '16 14:08 burdzand

Found the solution for Ubuntu webpack rebuild issue.

Seems it was indeed an problem with inotify max_user_watches as told by @Namek

sudo echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf

thesunnypro avatar Nov 09 '16 08:11 thesunnypro

Changing fs.inotify.max_user_watches to 16384 worked for me. The strange thing is that it used to work with 8k watches, anyone knows the reason for the increased number of watches in webpack ?

nikoTM avatar Nov 10 '16 20:11 nikoTM

I use Vagrant with shared folder to run angular-cli and changing fs.notify.max_user_watches didn't work for me. As I found here: https://github.com/webpack/webpack-dev-server/issues/155#issuecomment-159140735 one solution is to specify --watch-poll option for webpack-dev-server.

So when I change this line: https://github.com/angular/angular-cli/blob/master/packages/angular-cli/tasks/serve-webpack.ts#L83 to poll: true, the reloading starts to work. It's pretty slow though...

dmikhaylov avatar Nov 13 '16 15:11 dmikhaylov

@dmikhaylov thanks dear, worked for me

//poll: config_1.CliConfig.fromProject().config.defaults.poll
poll: true

and for slow issue try increasing vb.memory to double the current value.

muh-atta avatar Nov 14 '16 17:11 muh-atta

I have the same issue on MacOS X. It seems to be a problem with just ng server - whereas ng build --watch seems to function as expected.

ng --version Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info. angular-cli: 1.0.0-beta.19-3 node: 6.5.0 os: darwin x64

I did notice something that may be a hint. It seems the outDir is being deleted and recreated. If I stay in the outDir and monitor the contents of main.bundle.js after a rebuild the directory is empty. If I cd up and back into the outDir the files have been recreated, but the contents are not correct - main.bundle.js does not contain the change that I made.

With ng build --watch I do not experience the same behavior. After a rebuild the outDir contents have been recreated, but not the directory itself. The directory continues to be valid and the contents reflect the change made.

It seems that there are 2 different things going on there ... but thought the additional info may help.

klmcwhirter avatar Nov 23 '16 20:11 klmcwhirter

I had the same problem. I fixed it by simply moving the folder. it was in my "Dropbox (Personal)" folder before. I suspect the reload is tripping over the parentheses.

kareljan avatar Dec 13 '16 15:12 kareljan

Thanks to @dmikhaylov , for Vagrant users, adding "poll":true in angular.cli.json file fixed the issue for me.

ghost avatar Dec 13 '16 19:12 ghost

I had the same problem with sub-modules. I guess it has to do with special symbols in path name.

Changing dir name from mf-tracker to mfTracker worked for me.

pyarun avatar Jan 15 '17 16:01 pyarun

For watching changed files I confirm that setting a higher max_user_watches for inotify worked for me. It was 8k by default. It now rebuilds the bundles on file save.

However, I'm serving my website using Apache 2.4.25. The website reload functionality not working. Is it something that only "ng serve" does?

papaiatis avatar Feb 01 '17 09:02 papaiatis

Same issue, Angular CLI : 1.0.0-beta.28.3 Node: 7.5.0 OS : Win32 x64

No spaces to app .. here's the path : c:\dev\myapp

I reinstalled node and angular a couple of time but nothing worked.

shoaib0077 avatar Feb 02 '17 17:02 shoaib0077

Same issue after installing to latest CLI.

Angular CLI : 1.0.0-beta.28.3 Node: 7.5.0 OS : Win10 x64

No spaces in path.

medeirosrich avatar Feb 02 '17 18:02 medeirosrich

Same issue here.

Angular-cli: 1.0.0-beta.28.3 node: 7.0.0 Os: Win10 x64

I reinstalled angular-cli in local and global also npm cache clean but didn't work. path is ok as well.

ghost avatar Feb 02 '17 20:02 ghost

Same here, Angular-cli 1.0.0-beta.28.3, node: 6.5.0 Os: Win7 x64

matze1234 avatar Feb 02 '17 21:02 matze1234

Same issue after install beta.28.3 Os: Windows 10 x64

miguelcaravantes avatar Feb 02 '17 21:02 miguelcaravantes

the problem is the new version the @ngtools/webpack i solved it go back to beta26 and @ngtools/[email protected]

this command npm install --save @ngtools/[email protected]

maybe work in beta 28

miguelcaravantes avatar Feb 02 '17 23:02 miguelcaravantes

thanks @miguelcaravantes, that worked for me.

matze1234 avatar Feb 03 '17 00:02 matze1234

Thanks @miguelcaravantes that worked for me too.

shoaib0077 avatar Feb 03 '17 00:02 shoaib0077

Thanks @miguelcaravantes that worked for me too.

steveo99 avatar Feb 03 '17 03:02 steveo99

Thanks @miguelcaravantes that worked for me too.

silverfoxdev avatar Feb 03 '17 05:02 silverfoxdev

Same problem here guys:

ng --version
angular-cli: 1.0.0-beta.28.3
node: 7.4.0
os: darwin x64

rafaell-lycan avatar Feb 03 '17 12:02 rafaell-lycan