如何在Visual Studio代码中使用Node-Sass将scss文件编译为CSS文件?

我正在尝试安装node-sass以将scss文件编译为Visual Studio Code中的css文件。我已经安装了node-sass并按照Visual Studio Code网站上的指导进行了所有操作,但是没有用。

我得到了以下通知,而不是像Visual Studio Code网站上的指南那样创建的css文件,以及youtube,google等其他媒体。

[The term 'node-sass' is not recognized as the name of a cmdlet,function,script file,or operable program. Check the spelling of the nam
e,or if a path was included,verify that the path is correct and try again.

At line:1 char:10
+ node-sass <<<<  styles.scss styles.css
    + CategoryInfo          : ObjectNotFound: (node-sass:String) [],CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException]

我在哪里做错了?你能告诉我如何解决这个问题吗?

特别是,我已完成以下步骤:

  1. 安装npm,node.js

  2. 通过语法安装:npm install -g node-sass less

  3. 创建具有以下内容的task.json:

// Sass configuration

{

  // See https://go.microsoft.com/fwlink/?LinkId=733558

  // for the documentation about the tasks.json format

  "version": "2.0.0","tasks": [

    {

      "label": "Sass Compile","type": "shell","command": "node-sass styles.scss styles.css","group": "build"

    }

  ]

}
  1. 我还仔细检查了task.json文件中的scss文件名是否与Visual Studio Code的资源管理器窗口中的scss文件名相同,并仔细检查了scss路径文件。它们完全准确。

  2. 使用Ctrl Shift B组合键,然后选择Sass Compile> Continue,而不扫描任务输出。

yangwei521 回答:如何在Visual Studio代码中使用Node-Sass将scss文件编译为CSS文件?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3128281.html

大家都在问