0

I'm trying to compile sass using the terminal. I already installed node.js, and I didn't have any problem when using Live Sass, however, every time I try to compile my sass I get this:

sass : The term 'sass' is not recognized as the name of a cmdlet, function, script file, or operable program.     
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sass -watch scss:css
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (sass:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I'm trying to use @use and I know the Live Sass compiler won't let me do that. Is there anything I'm doing wrong? Or something else that I need to install? Oh, I already installed sass using npm install sass.

2 Answers2

0

You have 2 options:

  1. Try installing it globally

    npm install -g node-sass

  2. Add this the package.json file

    "devDependencies": {
     "node-sass": "4.5.0"
     },
    "scripts" : {
       "node-sass": "node-sass --output-style compressed -o dist/css src/scss"
    }
    

    After that, run:

    npm i;npm run node-sass;
    
Ran Turner
  • 14,906
  • 5
  • 47
  • 53
  • I just tried that, but it just gave a bunch of errors, and honestly, I'm just starting to use the terminal or anything else deeper than plain HTML and CSS. I want to install dart sass, because Watch Sass doesn't let me use ```@forward``` and ```@use``` and I know that ```@import``` is becoming deprecated. Any other recommendations? – Andrea Alvarez Apr 11 '21 at 23:32
0

Head up: there are several way to use SASS with VS Code. But make sure to use the most actual version running with Dart SASS. To install that via NPM here are some information:

Is it better to use the Live Sass Compiler (VS Code extension) or to install and run Sass via npm? (+ tips how to change from node-sass to dart-sass)

And here are some information about using SASS by installing an VS Code Extension which maybe makes it a little bit mor comfortable to use it:

Live Sass Compiler - @use causes compilation error

Brebber
  • 2,986
  • 2
  • 9
  • 19
  • Thanks, I was able to find a Live Sass Compiler that allows me to use Dart SASS. Haven't finished trying it yet, but I think this will solve my problem, even if I still can't use npm with my terminal. Link: https://marketplace.visualstudio.com/items?itemName=glenn2223.live-sass – Andrea Alvarez Aug 04 '21 at 19:16