sass / node-sass

:rainbow: Node.js bindings to libsass
https://npmjs.org/package/node-sass
MIT License
8.51k stars 1.32k forks source link

Deleting a .scss file gives watcher.deleted is not a function #2248

Closed webfaqtory closed 6 years ago

webfaqtory commented 6 years ago

Everything works fine until I delete a watched .scss file then I get

TypeError: watcher.deleted is not a function at Gaze. (/var/www/dev/web/themes/custom/acas/node_modules/node-sass/bin/node-sass:266:21) at emitOne (events.js:116:13) at Gaze.emit (events.js:211:7) at Gaze.emit (/var/www/dev/web/themes/custom/acas/node_modules/gaze/lib/gaze.js:128:32) at /var/www/dev/web/themes/custom/acas/node_modules/gaze/lib/gaze.js:408:18 at Array.forEach () at /var/www/dev/web/themes/custom/acas/node_modules/gaze/lib/gaze.js:404:12 at FSReqWrap.oncomplete (fs.js:135:15)

In watcher.js there is no function called watcher.deleted but there is watcher.removed. Editing node-sass to call this instead gives 'Error: ENOENT: no such file or directory,'. Had to give up

nschonni commented 6 years ago

Looks like we don't have any tests around the remove right now https://github.com/sass/node-sass/blob/master/test/watcher.js I would have thought that removed would have been correct since that is the function in lib/watcher @xzyfer thoughts?

xzyfer commented 6 years ago

I guess this is related to https://github.com/sass/node-sass/pull/2181/files

CaitlinWeb commented 6 years ago

I'm new to using node-sass but I tried the watch option and got the exact same error as OP. The error appears on the first change, which was not deleting anything. Here is the full error I get (with the filepath removed).

...node-sass\bin\node-sass:266
    handler(watcher.deleted(file));
                    ^

TypeError: watcher.deleted is not a function
    at Gaze.<anonymous> (...node-sass\bin\node-sass:266:21)
    at Gaze.emit (events.js:160:13)
    at Gaze.emit (...node-sass\node_modules\gaze\lib\gaze.js:128:32)
    at ...node-sass\node_modules\gaze\lib\gaze.js:408:18
    at Array.forEach (<anonymous>)
    at ...node-sass\node_modules\gaze\lib\gaze.js:404:12
    at FSReqWrap.oncomplete (fs.js:149:20)

I'm on Windows, and using 4.7.2 as well. Could be relevant, but I have other error warnings (not worth explaining unless you think it has to do with this error).

kuzyo commented 6 years ago

Getting the same error as @CaitlinWeb. What is the best way to fix ? Thanks.

node-sass       4.7.2   (Wrapper)       [JavaScript]
libsass         3.5.0.beta.2    (Sass Compiler) [C/C++]
xzyfer commented 6 years ago

This is fixed in 4.8.1. We've temporarily unpublished it due #2280. The fix is to wait until we 4.8.2 is released.

kuzyo commented 6 years ago

@xzyfer Thanks for the fast response. When do you plan to release 4.8.2 ?

xzyfer commented 6 years ago

When there is a resolution to #2280. You can subscribe to that issue for updates.

CaitlinWeb commented 6 years ago

After updating to 4.8.2 I haven't gotten the error yet. Seems to be fixed. Thanks!

davismj commented 6 years ago

Same in 4.8.3

fs.js:994
  binding.lstat(pathModule._makeLong(path), statValues);
          ^

Error: ENOENT: no such file or directory, lstat 'path\to\test.scss'