michaelwayman / node-sass-chokidar

A thin wrapper around node-sass to replicate the --watch using chokidar instead of Gaze
MIT License
291 stars 34 forks source link

Error on running command #47

Closed balazsorban44 closed 6 years ago

balazsorban44 commented 6 years ago

I am getting the attached error when I run yarn start

my package.json has:

    "build-css": "node-sass-chokidar --include-path ./src/sass src/sass/main.sass src/main.css",
    "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src/sass src/sass/main.sass src/main.css -w -r",
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",

Node: 9.4.0 Yarn: 1.5.1 node-sass-chokidar: 1.2.0 on Ubuntu 17.10

The error appeared only yesterday, before that, it worked just fine. I recently updated from 1.1.2, so I reinstalled my node_modules with 1.1.2, but it throws the same error.

path.js:28
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', 'string');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1179:7)
    at FSWatcher.<anonymous> (../web/node_modules/node-sass-chokidar/bin/node-sass-chokidar:316:27)
    at FSWatcher.emit (events.js:160:13)
    at FSWatcher.<anonymous> (../web/node_modules/chokidar/index.js:196:15)
    at FSWatcher._emit (../web/node_modules/chokidar/index.js:238:5)
    at FSWatcher.NodeFsHandler._handleFile (../web/node_modules/chokidar/lib/nodefs-handler.js:275:10)
    at FSWatcher.<anonymous> (../web/node_modules/chokidar/lib/nodefs-handler.js:473:21)
    at FSReqWrap.oncomplete (fs.js:167:5)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c npm run build-css && node-sass-chokidar --include-path src/sass src/sass/main.sass src/main.css -w -r
Directory: ../web
Output:
".

If I remove the -w and -r flags, it does not crash, but than watching is not working.

PS.: I checked, it stopped working on my other similar project too, with the same error.

wbruntra commented 6 years ago

Looks to be related to: https://github.com/michaelwayman/node-sass-chokidar/issues/48

There seems to be a problem with using a single file as input right now, so one possibility would be to use the whole directory instead, so:

npm run build-css && node-sass-chokidar --include-path ./src/sass src/sass/main.sass src/main.css -w -r becomes: npm run build-css && node-sass-chokidar --include-path ./src/sass src/sass/ src/ -w -r

michaelwayman commented 6 years ago

try the latest version 1.2.1 and let me know. but as an asside, you don't believe you specify an output file so much as an output directory.. issue left over from node-sass I believe

balazsorban44 commented 6 years ago

I just tried node-sass, and my script worked without any modifications. I don't really understand what broke it, 'cause until like 3-4 days ago, it worked just fine on all my projects, with node-sass-chokidar :confused: too. Now, whichever version I use after a clean Node install it does not work, no matter what project I am trying on. But since I really don't have big projects, I think I will stick to node-sass for the time being, for as I understood, this package's only advantage would be speed compared to node-sass. Sorry if I am wrong. Anyway, the package problem is not resolved for me, but since I found a way around, I close this issue. Thanks for the help anyway!

michaelwayman commented 6 years ago

Sorry, I rushed some bug fixes and features without giving them my full attention, but anyway your bug should be fixed if you ever want to switch back to node-sass-chokidar. Thanks for reporting the issue.