Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.watch not work in win10 Bash. #7496

Closed
fallingarrow opened this issue Jun 30, 2016 · 10 comments
Closed

fs.watch not work in win10 Bash. #7496

fallingarrow opened this issue Jun 30, 2016 · 10 comments
Labels
windows Issues and PRs related to the Windows platform. wsl Issues and PRs related to the Windows Subsystem for Linux.

Comments

@fallingarrow
Copy link

win10 provides developers with a familiar Bash environment.
I'm try to use node in win10 Bash,fs.watch not work ,throw EPERM exception.
fs.watchFile is ok.

node version : v6.2.1. (Linux Binaries)
window version : windows 10 insider preview 14366
linux subsystem version : Linux DESKTOP-RNI52ML 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux

test file

test.js

var path = require('path');
fs.watch('/home/li/app1/', function(event) {
console.info(event)
})

exception :

fs.js:1425
throw error;
^
Error: watch /home/li/app1/ EPERM
at exports._errnoException (util.js:1007:11)
at FSWatcher.start (fs.js:1423:19)
at Object.fs.watch (fs.js:1450:11)
at Object. (/mnt/c/Users/li/git/portal/integration_fe/test.js:4:4)
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 Function.Module.runMain (module.js:575:10)

@bnoordhuis
Copy link
Member

I suspect the Linux subsystem doesn't implement inotify yet or puts some restraints on it. Almost certainly not a bug in node.js.

@bnoordhuis bnoordhuis added windows Issues and PRs related to the Windows platform. unconfirmed labels Jun 30, 2016
@fallingarrow
Copy link
Author

I just wrote a cpp program to test inotify api , the inotify_add_watch return -1 , not work.
I've completed a feedback to MS Insider Program.

thank you!

@bnoordhuis
Copy link
Member

Thanks, I'll close out the issue.

@ghost
Copy link

ghost commented Jul 29, 2016

I did some tweets and hopefully they made it it to Microsoft to do list, hopefully the high priority list hehe

@ghost
Copy link

ghost commented Aug 3, 2016

I found best way to notify microsoft the importance of fixing this issue. Vote here: support-for-filesystem-watchers-like-inotify Currently it's # 5!

also Windows Subsystem For Linux (WSL) User Voice main page

and Github page for reporting issues

and Github WSL Issue for this issue

@bitcrazed
Copy link

bitcrazed commented Oct 7, 2016

This should now work in Windows 10 Insider builds >= 14942

@wclr
Copy link

wclr commented Apr 23, 2017

@bitcrazed I have just singup for Insider Preview Builds in windows settings, and installed updates after it, but my build is 14393 (in System Information). Is it correct? Am I able to get higher builds?

@refack
Copy link
Contributor

refack commented Apr 23, 2017

@bitcrazed I have just singup for Insider Preview Builds in windows settings, and installed updates after it, but my build is 14393 (in System Information). Is it correct? Am I able to get higher builds?

@whitecolor, Windows Creator Update was released you should be able to get Microsoft Windows [Version 10.0.15063] easily - https://blogs.windows.com/windowsexperience/?p=144461

@refack
Copy link
Contributor

refack commented Apr 23, 2017

I can confirm it works with node v7.8.0 on Microsoft Windows [Version 10.0.15063]
P.S. c:\code in a symlink to d:\code hence /mnt/c/code == /mnt/d/code

var fs = require('fs');                         
fs.watch('/mnt/d/code/4node', function(event) { 
  console.info('/mnt/d/code/4node')             
  console.info(event)                           
})                                              
                                                
fs.watch('/home/refael', function(event) {      
  console.info('/home/refael')                  
  console.info(event)                           
})                                              
refael@refaelux:/mnt/d/code/4node$ node test-7496.js
refael@refaelux:~$ touch test.test
/home/refael
rename
/home/refael
change
refael@refaelux:/mnt/c/code/4node$ touch test.test
/mnt/d/code/4node
rename
/mnt/d/code/4node
change
/mnt/d/code/4node
change
refael@refaelux:/mnt/d/code/4node$ rm test.test
/mnt/d/code/4node
rename
/mnt/d/code/4node
rename
/mnt/d/code/4node
rename

@wclr
Copy link

wclr commented Apr 23, 2017

@refack uh yes thanks for the tip)

@refack refack added the wsl Issues and PRs related to the Windows Subsystem for Linux. label Jul 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues and PRs related to the Windows platform. wsl Issues and PRs related to the Windows Subsystem for Linux.
Projects
None yet
Development

No branches or pull requests

5 participants