Zac
Zac

Reputation: 59

sass error: No such file or directory

Sass is throwing an error on multiple projects on both of my computers when I try to compile the scss files to css. I'm using dart-sass. I'm typing the command in the terminal from the root of the projects and the file path is correct. I've tried both

sass --watch src/styles/scss:src/styles/css

and also just

sass src/styles/scss:src/styles/css

but the results are the same:

Error reading src/styles/scss:src/styles/css: no such file or directory.

As such I can't compile any of my style files.

Upvotes: 2

Views: 22557

Answers (3)

Aakash Goplani
Aakash Goplani

Reputation: 1354

In the terminal, I had to make my way to the file location and then run the command. Example:

Project Structure:

src
   abc
      prq
         main.html
         main.scss

When I launch the terminal, it defaults to src folder

PS C:\Users\src> sass --watch main.scss:main.css

Running command here will throw error:

Error reading main.scss: no such file or directory.

Now, browsing to prq directory & running command, will be successful.

PS C:\Users\src\abc\pqr> sass --watch main.scss:main.css

Compiled main.scss to main.css.
Sass is watching for changes. Press Ctrl-C to stop.

Upvotes: 0

Zac
Zac

Reputation: 59

Okay, I figured out a solution if anyone else runs into this problem. You should uninstall dart sass from your computer(prefix this command with sudo if using mac):

npm uninstall sass -g

Then, install a stable version of ruby sass:

gem install sass

Now you should be able to run sass --watch src/styles/scss:src/styles/css and it will compile.

Note: If you were to do npm install sass that would install the latest version written in dart, which is what seems to have caused my problems.

Upvotes: 1

Ramy Ragab
Ramy Ragab

Reputation: 129

filename is required to select directory


Try this sass --watch src/styles/scss/fileName.scss:src/styles/css

Upvotes: 1

Related Questions