[英]VS Code won't let me compile sass using sass --watch
I'm trying to compile sass using the terminal.我正在尝试使用终端编译 sass 。 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:
我已经安装了 node.js,并且在使用 Live Sass 时没有任何问题,但是,每次我尝试编译我的 sass 时我都会得到这个:
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.我正在尝试使用
@use
,我知道 Live Sass 编译器不会让我这样做。 Is there anything I'm doing wrong?有什么我做错了吗? Or something else that I need to install?
还是我需要安装的其他东西? Oh, I already installed sass using
npm install sass
.哦,我已经安装了 sass 使用
npm install sass
。
You have 2 options:您有 2 个选项:
Try installing it globally尝试全局安装
npm install -g node-sass npm install -g node-sass
Add this the package.json file添加这个 package.json 文件
"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;
Head up: there are several way to use SASS with VS Code.注意:有几种方法可以将 SASS 与 VS 代码一起使用。 But make sure to use the most actual version running with
Dart SASS
.但请确保使用与
Dart SASS
运行的最实际版本。 To install that via NPM here are some information:要通过 NPM 安装它,这里有一些信息:
Is it better to use the Live Sass Compiler (VS Code extension) or to install and run Sass via npm? 是使用 Live Sass 编译器(VS 代码扩展)还是通过 npm 安装和运行 Sass 更好? (+ tips how to change from node-sass to dart-sass)
(+ 提示如何从 node-sass 更改为 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:这里有一些关于通过安装 VS 代码扩展来使用 SASS 的信息,这可能会让使用它更舒服一点:
Live Sass Compiler - @use causes compilation error Live Sass 编译器 - @use 导致编译错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.