WSL icon indicating copy to clipboard operation
WSL copied to clipboard

NPM Webpack not watching

Open BeneCollyridam opened this issue 10 years ago • 20 comments

Using node with webpack and babel

New code doesn't compile automatically. Possibly due to not enough watchers. When trying to fix this with:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

I get the error:

sysctl: cannot stat /proc/sys/fs/inotify/max_user_watches: No such file or directory

I am running Windows 10 Insider Preview Build 14342

BeneCollyridam avatar May 19 '16 12:05 BeneCollyridam

@BeneCollyridam inotify is currently not implemented (this is also brought up in #216). Does the code you're compiling require inotify support? If we were reporting max_user_watches = 0 would compilation continue?

benhillis avatar May 19 '16 15:05 benhillis

No, it does not require I notify. It was meant to automatically recompile when changed but I guess I'll just have to wait.

BeneCollyridam avatar May 20 '16 06:05 BeneCollyridam

@BeneCollyridam that seems very useful! Inotify is definitely something that is on our backlog.

benhillis avatar May 21 '16 22:05 benhillis

Related: it seems that brunch does not work at all without inotify. (Brunch is an alternative to webpack)

edit: I was wrong, Brunch live reloading is working when watcher: {usePolling: true} is set in brunch config.

michallepicki avatar May 29 '16 21:05 michallepicki

Basically anything that uses chokidar doesn't work.

A few things I've tried: grunt-contrib-watch, budo, stylus -w

quantizor avatar Jun 13 '16 03:06 quantizor

Just FYI, I landed a patch on Chokidar that will fix things for the time being. Before you run your subdependency that uses chokidar, set the environment variable CHOKIDAR_USEPOLLING=1.

Requires [email protected], but better than nothing.

quantizor avatar Jul 02 '16 06:07 quantizor

@yaycmyk Although your method works, it's really not ideal. Using it will cause nodejs to use 100% cpu, sadly - at least in my case. Is there a workaround for that?

ivoviz avatar Jul 24 '16 16:07 ivoviz

@ivoviz Not until the proper subsystems are implemented, unfortunately.

quantizor avatar Jul 24 '16 16:07 quantizor

Take a hard look at what's being watched and try to make the patterns as narrow as possible - your watch is likely looking at more things than it needs to...

quantizor avatar Jul 24 '16 16:07 quantizor

Unfortunately I can't really control what's being watched, it's been done by angular-cli. This really is a huge blocker.

ivoviz avatar Jul 24 '16 16:07 ivoviz

I also see this as a huge blocker for BashOnWindows. I can't get my webpack config to work at all, even if I try to remove watch and inline options. I'm using webpack-dev-server. I get many errors like this one:

    ERROR in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./css/site.scss
    Module build failed: Error: EINVAL: invalid argument, uv_interface_addresses
        at Error (native)
        at Object.lib.networkInterfaces (/mnt/c/Stuff/Git/showdown/node_modules/macaddress/index.js:31:21)
        at Object.lib.one (/mnt/c/Stuff/Git/showdown/node_modules/macaddress/index.js:79:26)
        at Object.<anonymous> (/mnt/c/Stuff/Git/showdown/node_modules/uniqid/index.js:15:77)
        at Module._compile (module.js:541:32)
        at Object.Module._extensions..js (module.js:550:10)
        at Module.load (module.js:458:32)
        at tryModuleLoad (module.js:417:12)
        at Function.Module._load (module.js:409:3)
        at Module.require (module.js:468:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/mnt/c/Stuff/Git/showdown/node_modules/postcss-filter-plugins/dist/index.js:9:15)
        at Module._compile (module.js:541:32)
        at Object.Module._extensions..js (module.js:550:10)
        at Module.load (module.js:458:32)
        at tryModuleLoad (module.js:417:12)

mikeesouth avatar Aug 03 '16 10:08 mikeesouth

yes, BashOnWindows is exciting, but without this being fixed, we just can not start our dev work with it -- just need the watch feature ~

wangxiexe avatar Aug 07 '16 11:08 wangxiexe

This issue has been solved as of build 14942

See #216

kayakyakr avatar Oct 10 '16 15:10 kayakyakr

@mikeesouth This issue still is not solved as far as I can tell. On the newest fast-ring. uv_interface address issues are seperate from inotify. This is network enunaration. Looking for a fix to a very similar error.

leafoflegend avatar Nov 07 '16 00:11 leafoflegend

@all as of build #14946 WSL supports inotify. @BeneCollyridam please verify and then close this issue.

@mikeesouth the uv_interface_address error has also been solved as of 14986

jackchammons avatar Dec 05 '16 20:12 jackchammons

This still doesn't work for me. Surface Pro 4 with FCU.

I keep getting the same error message as in the original question on the thread.

Did something change in the FCU?

bajjuri6 avatar Oct 26 '17 09:10 bajjuri6

did you install inotify-tools in ubuntu?

michallepicki avatar Oct 26 '17 10:10 michallepicki

I just did. Doesn't seem to make a difference.

bajjuri6 avatar Oct 26 '17 13:10 bajjuri6

A few things that might help some of you:

  1. Ensure you don't have the poll property set in your watchOptions; it doesn't seem to work with WSL.
  2. You also need to run WSL with elevation (run as administrator) in order for watching to work.

Optional You may also want to check if there are any other processes creating a lock on the files you're watching. I've noticed some pretty finicky behavior when running I/O on a file from both the WSL side & native.

jonnyasmar avatar Dec 15 '17 23:12 jonnyasmar

Did anyone find a solution for this in windows? I'm having a loop error because of watchers when I run ng serve on visual studio code on windows, I excluded the big files from the watcher but still having the same problem. Anyone has an idea on how to fix this in windows? Or how we add more watchers (on windows)? thx

GhadaAJIMI avatar Jun 02 '22 13:06 GhadaAJIMI