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

CLI watcher crashes when it encounters empty tags/files or missing brackets #2479

Open
Ansraer opened this issue Aug 18, 2018 · 0 comments
Open

Comments

@Ansraer
Copy link

Ansraer commented Aug 18, 2018

  • NPM version (npm -v): 5.6.0
  • Node version (node -v): 8.11.3
  • Node Process (node -p process.versions):
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): node-sass 4.9.3, libsass 3.5.4
  • npm node-sass versions (npm ls node-sass): 4.9.3

I recently switched over to sass and am now in the process of updating my build scripts. However, I can't seem to get the following command to work.
"watch-sass": "node-sass src/ -o dist/ -w",
It works fine in most cases, but whenever I create an empty .scss file it crashes for good and I have to manually restart the watch process.

An example for a scss file that causes such a crash would be the following:

h1 {

}

I have also managed to produce this problem by using sass syntax instead of scss inside one of my files or by not closing one of my brackets before saving.

Here is the error log:

> node-sass src/ -o dist/ -w

D:\Development\Projekte\AssertShareWeb\node_modules\scss-tokenizer\lib\tokenize.js:265
                if (ident.test(css) && (ident.lastIndex = pos || 1) && ident.exec(css).index === pos) {
                                                                                      ^

TypeError: Cannot read property 'index' of null
    at tokenize (D:\Development\Projekte\AssertShareWeb\node_modules\scss-tokenizer\lib\tokenize.js:265:87)
    at Object.scss.tokenize (D:\Development\Projekte\AssertShareWeb\node_modules\scss-tokenizer\lib\entry.js:18:35)
    at parseImports (D:\Development\Projekte\AssertShareWeb\node_modules\sass-graph\parse-imports.js:4:26)
    at Graph.addFile (D:\Development\Projekte\AssertShareWeb\node_modules\sass-graph\sass-graph.js:69:17)
    at D:\Development\Projekte\AssertShareWeb\node_modules\sass-graph\sass-graph.js:54:13
    at arrayEach (D:\Development\Projekte\AssertShareWeb\node_modules\lodash\lodash.js:516:11)
    at Function.forEach (D:\Development\Projekte\AssertShareWeb\node_modules\lodash\lodash.js:9342:14)
    at new Graph (D:\Development\Projekte\AssertShareWeb\node_modules\sass-graph\sass-graph.js:53:7)
    at Object.module.exports.parseDir (D:\Development\Projekte\AssertShareWeb\node_modules\sass-graph\sass-graph.js:156:17)
    at Object.watcher.reset (D:\Development\Projekte\AssertShareWeb\node_modules\node-sass\lib\watcher.js:17:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! assetshare@0.0.0 watch-sass: `node-sass src/ -o dist/ -w`
npm ERR! Exit status 1

In order to avoid this I am currently creating my own watcher using nodemon:

    "watch-css": "nodemon -e sass,scss -x \"npm run build-sass\"",
    "build-sass": "node-sass src/ -o dist/",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants