microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.47k stars 822 forks source link

NPM Webpack not watching #396

Closed BeneCollyridam closed 7 years ago

BeneCollyridam commented 8 years ago

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

benhillis commented 8 years ago

@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?

BeneCollyridam commented 8 years ago

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

benhillis commented 8 years ago

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

michallepicki commented 8 years ago

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.

quantizor commented 8 years ago

Basically anything that uses chokidar doesn't work.

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

quantizor commented 8 years ago

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 chokidar@1.6.0, but better than nothing.

ivoviz commented 8 years ago

@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?

quantizor commented 8 years ago

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

quantizor commented 8 years ago

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...

ivoviz commented 8 years ago

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

mikeesouth commented 8 years ago

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)
wangxiexe commented 8 years ago

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

kayakyakr commented 8 years ago

This issue has been solved as of build 14942

See #216

leafoflegend commented 8 years ago

@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.

jackchammons commented 7 years ago

@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

bajjuri6 commented 7 years ago

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?

michallepicki commented 7 years ago

did you install inotify-tools in ubuntu?

bajjuri6 commented 7 years ago

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

jonnyasmar commented 6 years ago

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.

GhadaAJIMI commented 2 years ago

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