Error: ENOTDIR: not a directory, scandir
TheColorRed opened this issue ยท 5 comments
I am not sure where the issue lies, but I am using watch to watch for file changes on my js file, and when a change happens it should minifiy the js file. This works on my Ubuntu machine, but on my Windows machine, I get the error below.
> watch.cmd --interval=1 uglifyjs.cmd -c -m -o ./public/assets/js/prefab.min.js -- ./public/assets/js/prefab.js
> Watching ./public/assets/js/prefab.js
C:\Users\rnaddy\AppData\Roaming\npm\node_modules\watch\main.js:73
if (err) throw err;
^
Error: ENOTDIR: not a directory, scandir 'C:\Users\rnaddy\Documents\vscode\projects\prefab\public\assets\js\prefab.js'
Any update on this issue?
I am getting same issue.
I think this comes from the fact that you're trying to watch a file and that this tool can only watch directories. I ran into the same problem ๐
That being said, I was able to get around it by building a custom filter and then just checking for the file I want. It was relatively painless https://github.com/mikeal/watch#watchcreatemonitorroot-options-callback
@mikeal I wonder how difficult it would be difficult to allow watching a file? I'm willing to help with this ๐
@JuanCaicedo Please could you share your custom filter code?
Thanks
I think my issue was that on one machine the file existed which is why it worked and the other machine it didn't exist.
What would be nice would be to watch a file for creation as well.