Sebastian Nielsen
Sebastian Nielsen

Reputation: 4199

File watcher: "An output directory must be specified when compiling a directory"

cmd.exe /D /C call C:\Users\sebas\AppData\Roaming\npm\node-sass.cmd style.scss:style.css An output directory must be specified when compiling a directory

enter image description here

The scss file I want the file watcher to watch is placed at the root of my project.

Watch the error appear: gif_link

How do I fix this error?

Upvotes: 3

Views: 14179

Answers (3)

Predrag Davidovic
Predrag Davidovic

Reputation: 1566

I got same error working with webpack bundler and setting my scripts in package.json

In my case to resolve this issue you need to add output directory ( -o name-of-directory).

If working with scripts in package.json it should look like this:

scripts: {
    "scss": "node-sass --watch src -o src"
}

src is folder where sass file which I want to compile is placed.

It means compile sass from src folder and send compiled files to src folder.

In this case css file will be placed on same place where sass file already is.

Upvotes: 1

Petr Pánek
Petr Pánek

Reputation: 389

With node-sass for me is working to set Arguments to $FileName$ -o . $FileNameWithoutExtension$.css

and unchecked "Create output file from stdout".

Upvotes: 0

lena
lena

Reputation: 93728

If you like the .css files to be generated in the same folder as original file, try the following settings:

enter image description here

Note the Create output file from stdout option - it has to be enabled, as node-sass writes CSS to stdout unless the -o option is passed.

If you like to place generated files in a separate folder, use the -o option:

enter image description here

Upvotes: 5

Related Questions