ASP.NET 核心 - 无法卸载节点 - sass

ASP.NET Core - cannot uninstall node-sass

当我构建 Angular12 ASP.NET Core 5.0.7 应用程序时,我收到此警告

'node-sass' usage is deprecated and will be removed in a future major version. To opt-out of the deprecated behaviour and start using 'sass' uninstall 'node-sass'

我尝试了 npm uninstall node-sass,它没有错误地完成,但是节点模块中的警告和 node-sass 文件夹仍然存在。

如何删除 node-sass

编辑 在包锁中我看到以下内容:

    "node_modules/node-sass": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-5.0.0.tgz",
      "integrity": "sha512-opNgmlu83ZCF792U281Ry7tak9IbVC+AKnXGovcQ8LG8wFaJv6cLnRlc6DIHlmNxWEexB5bZxi9SZ9JyUuOYjw==",
      "dev": true,
      "hasInstallScript": true,
      "optional": true,
      "peer": true,
      "dependencies": {
        "async-foreach": "^0.1.3",
        "chalk": "^1.1.1",
        "cross-spawn": "^7.0.3",
        "gaze": "^1.0.0",
        "get-stdin": "^4.0.1",
        "glob": "^7.0.3",
        "lodash": "^4.17.15",
        "meow": "^3.7.0",
        "mkdirp": "^0.5.1",
        "nan": "^2.13.2",
        "node-gyp": "^7.1.0",
        "npmlog": "^4.0.0",
        "request": "^2.88.0",
        "sass-graph": "2.2.5",
        "stdout-stream": "^1.4.0",
        "true-case-path": "^1.0.2"
      },
      "bin": {
        "node-sass": "bin/node-sass"
      },
      "engines": {
        "node": ">=10"
      }
    },

npm ls node-sass 给出:

`-- @angular-devkit/build-angular@12.0.5
  `-- sass-loader@11.0.1
    `-- node-sass@5.0.0

版本:

Angular CLI: 12.0.5
Node: 14.17.0
Package Manager: npm 7.14.0
OS: win32 x64

Angular: 12.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.5
@angular-devkit/build-angular   12.0.5
@angular-devkit/core            12.0.5
@angular-devkit/schematics      12.0.5
@schematics/angular             12.0.5
rxjs                            6.6.7
typescript                      4.2.4

您是否检查过该库是全局安装的,还是仍在您的 package.json 中?

1 - 确保它不在您的 package.json 和包中-lock.json 2 - 通过 运行 npm ls node-sass 检查另一个库是否包含它 3 - 这不应该是原因,但是,如果上面的 none 为您提供了更多信息,请尝试通过传递 -g.

从全局卸载