Node-sass: CLI: watch doesnt work after upgrading to 4.6.0 and 4.6.1

Created on 4 Nov 2017  路  10Comments  路  Source: sass/node-sass

After upgrading from 4.5.3 the command below has stopped working. Changing the scss file does nothing:

"css": "./node_modules/.bin/node-sass -w scss/style.scss public/css/style.css"

  • NPM version: 5.5.1
  • Node version: 8.9.0
  • Node Process:

    • http_parser: 2.7.0

    • node: 8.9.0

    • v8: 6.1.534.46

    • uv: 1.15.0

    • zlib: 1.2.11

    • ares: 1.10.1-DEV

    • modules: 57

    • nghttp2: 1.25.0

    • openssl: 1.0.2l

    • icu: 59.1

    • unicode: 9.0

    • cldr: 31.0.1

    • tz: 2017b

  • Node Platform: linux
  • Node architecture: x64
  • npm node-sass versions: 4.6.0
Bug - Confirmed Module - Watcher

Most helpful comment

Workaround

With the previous version the command works perfectly: npm install [email protected]

All 10 comments

Workaround

With the previous version the command works perfectly: npm install [email protected]

Using this command:

node-sass -w --output-style compressed -r ./scss --output ./public/css/

I get an error:

node/node_modules/node-sass/bin/node-sass:236
      if (watch.indexOf(file) === -1) {
                ^

TypeError: watch.indexOf is not a function

When I took a look at the watch object it's structured like:

{ '/scss/':
   [ '/scss/_includes.scss',
     '/scss/_settings.scss',
     '/scss/main.scss' ],

I removed the full path, but it's an object with key of directory path and an array of files in the directory. The if (watch.index) on *line 235 of node-sass/bin/node-sass isn't checking each of the keys in the object.... at least as far as I can tell.

Hope this helps.

Hey, this is just a simple fix. I've made a PR here: https://github.com/sass/node-sass/pull/2147

This is fixed in v4.6.1

I'm having what appears to be this same issue, in 4.6.1, when running the following. If I remove -w the file is output to my css folder, so I don't think I have a typo here. It seems that it isn't actually watching my _sass folder for changes.

"css-sass": "node-sass -w _sass --output css"

Not fixed. Same problem with node-sass -w input.scss output.css

npm install [email protected] works fine

@lucaseverett watch doesn't compile files till they are changed, don't use it as your compile script

Yes, I'm aware of that, but in this case watch isn't detecting changes.

Same behaviour - Windows 10 x64, node-sass 4.6.1

Reverting to 4.5.3 fixed the issue for me, am pinning on this version so I can keep moving.

We've just released 4.7.1 with additional fixes for the watcher

Was this page helpful?
0 / 5 - 0 ratings