X Tutup
The Wayback Machine - https://web.archive.org/web/20210715010957/https://github.com/Microsoft/WSL/issues/3395
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

EACCES when renaming folder that is being watched from nodejs #3395

Closed
alexdima opened this issue Jul 20, 2018 · 9 comments
Closed

EACCES when renaming folder that is being watched from nodejs #3395

alexdima opened this issue Jul 20, 2018 · 9 comments

Comments

@alexdima
Copy link
Member

@alexdima alexdima commented Jul 20, 2018

Microsoft Windows [Version 10.0.17134.112]

I am trying to use chokidar, a popular nodejs file system watcher library.

Whenever I use chokidar to listen for file system changes, I can no longer rename folders that lie within the folder being watched.

  • npm install chokidar
  • mkdir test
  • echo hello > test/test.txt
  • create repro.js:
var fs = require('fs');
var chokidar = require('chokidar');

// Watch current directory and ignore the node_modules folder
chokidar.watch('.', {ignored: /node_modules/}).on('all', (event, path) => {
  console.log(event, path);
});

// After sufficient time, attempt to rename the test folder
// Note: this is also reproducible using `mv` on the command line
setTimeout(function() {
    fs.rename('test', 'test2', function(err) {
        if (err) {
            console.log(err);
        } else {
            console.log('rename ok');
        }
    });
}, 1000);

WSL (Ubuntu 18.04):
image

Ubuntu 18.04:
image

I don't think it is terribly important (other colleagues are able to reproduce with other node versions), but I am using nodejs v8.11.3

@therealkenc
Copy link
Collaborator

@therealkenc therealkenc commented Jul 20, 2018

I don't think it is terribly important (other colleagues are able to reproduce with other node versions)

Nah it's a manifestation of about the most pervasive bug around here (if you don't count 0xhexdigits fail at startup). Call this dupe #1956 but you can pick any dating back to #14.

@qwabra
Copy link

@qwabra qwabra commented May 20, 2020

this does not work for me

code.visualstudio.com/docs

// settings.json
{
    "remote.WSL.fileWatcher.polling": true
}

but this is helped

// settings.json
{
    "files.watcherExclude": {
        "**/**/*": true
    }
}
@95th
Copy link

@95th 95th commented May 21, 2020

@qwabra I tried your approach and even that doesn't work.

I tried:

    "remote.WSL.fileWatcher.polling": true,

then

    "files.watcherExclude": {
        "**/**/*": true
    }

then both.

None of this works for me.

Can anyone please help?

@JordanSimba
Copy link

@JordanSimba JordanSimba commented Jun 14, 2020

This is pretty annoying... for now I just close VS code since the file watcher has a lock on the files, do file work in terminal or file explorer and reopen when done with code . in ubuntu.
Otherwise, unless there is a reason to not upgrade to WSL 2 I would suggest anybody does so.

@DerekNonGeneric
Copy link

@DerekNonGeneric DerekNonGeneric commented Jul 2, 2020

Why is the workaround from #3395 (comment) not explicitly stated in the VS Code docs section about known WSL limitations? It should note that all workspace files must be excluded from being watched otherwise the problem will persist…

@qwabra
Copy link

@qwabra qwabra commented Jul 13, 2020

...
for now I just close VS code since the file watcher has a lock on the files, do file work in terminal or file explorer and reopen
...

you can just open settings.json and switch trigger false/true in "**/*": false

{
    "files.watcherExclude": {
        //
        // block Svelte update
        "**/*": false,
        // "**/*": true,
        //
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/**": true,
        "**/.hg/store/**": true
    },
}

it can be set locally

(use workspace settings) .vscode/settings.json
see docs

@Spongman
Copy link

@Spongman Spongman commented Jul 31, 2020

something is fundamentally broken here. while having my remote-wsl workspace open in vscode, i get the following in a command prompt:

C:\WINDOWS\system32>handle my-directory-name | wsl wc -l
177481

that means the windows kernel has every single one of the files in my workspace open.

i have the following in my settings.json:

	"remote.WSL.fileWatcher.polling": true
@GEeKkk
Copy link

@GEeKkk GEeKkk commented Sep 12, 2020

this does not work for me

code.visualstudio.com/docs

// settings.json
{
    "remote.WSL.fileWatcher.polling": true
}

but this is helped

// settings.json
{
    "files.watcherExclude": {
        "**/**/*": true
    }
}

Thank you. This also solved my problem in installing go tools on WSL.

@SanjivG10
Copy link

@SanjivG10 SanjivG10 commented Sep 27, 2020

// settings.json (located in %appdata%/code/user/settings.json)
{
"files.watcherExclude": {
"//*": true
}
}

After saving it, restart VsCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
X Tutup