This repository was archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLI watcher crashes when it encounters empty tags/files or missing bracketsΒ #2479
Copy link
Copy link
Open
Description
- 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! [email protected] 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/",
wgminer and sosik