newrobot
newrobot

Reputation: 9

Can't seem to use the SASS --watch command when installing

Just node installed sass and keep getting an error when using:

node-sass style.scss --watch

This seems like a fairly recent bug since no one on the web has answered it.

Heres the error:

An output directory must be specified when compiling a directory An output directory must be specified when compiling a directory fs.js:965 binding.lstat(pathModule.toNamespacedPath(path)); ^

Error: ENOENT: no such file or directory, lstat 'style.scss' at Object.fs.lstatSync (fs.js:965:11) at Object.module.exports.parseDir (/Users/glenpegado/.nvm/versions/node/v9.9.0/lib/node_modules/node-sass/node_modules/sass-graph/sass-graph.js:153:10) at Object.watcher.reset (/Users/glenpegado/.nvm/versions/node/v9.9.0/lib/node_modules/node-sass/lib/watcher.js:17:21) at watch (/Users/glenpegado/.nvm/versions/node/v9.9.0/lib/node_modules/node-sass/bin/node-sass:260:20) at run (/Users/glenpegado/.nvm/versions/node/v9.9.0/lib/node_modules/node-sass/bin/node-sass:319:5) at Object. (/Users/glenpegado/.nvm/versions/node/v9.9.0/lib/node_modules/node-sass/bin/node-sass:405:3) at Module._compile (module.js:649:30) at Object.Module._extensions..js (module.js:660:10) at Module.load (module.js:561:32) at tryModuleLoad (module.js:501:12)

Upvotes: 1

Views: 4593

Answers (2)

muecas
muecas

Reputation: 4335

You have an error in the order of the parameters passed to node-sass. You passed the arguments reversed. The correct order is:

node-sass [options] <input> [output]

In case you want to watch a single file, you need to run:

node-sass --watch style.scss style.css

You can also use it to watch an entire folder. In that case you must specify the --output argument:

node-sass --watch source/folder --output destination/folder

You can read more about its usage and options here.

Hope it helps.

Upvotes: 3

Korgrue
Korgrue

Reputation: 3478

The error is telling you the issue. You need to define the output path. Node-sass terminal command should follow this syntax:

$ node-sass [options] <input.scss> [output.css]

In your example, you only defined the source document.

Upvotes: 1

Related Questions