Bootstrap 5 + SASS 错误:未定义的 MIXIN @include _assert-ascending

Joe*_*uez 10 sass node-sass scss-lint scss-mixins bootstrap-5

我正在按照 freecodecamp 教程学习 SCSS,但在 live sass 的 CLI 上不断收到以下错误:watch:

\n
Error: Undefined mixin.\n    \xe2\x95\xb7\n320 \xe2\x94\x82 @include _assert-ascending($grid-breakpoints, "$grid-breakpoints");\n    \xe2\x94\x82 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    \xe2\x95\xb5\n  node_modules\\bootstrap\\scss\\_variables.scss 320:1  @use\n  node_modules\\bootstrap\\scss\\bootstrap.scss 11:1    @import\n  scss\\_custom.scss 58:8                             @use\n  scss\\style.scss 1:1  \n
Run Code Online (Sandbox Code Playgroud)\n

任何在 SASS 方面更有经验的人都可以为我指出正确的方向吗?我不知道从这里该做什么。我需要将@use 的导入添加到custom.scss 中吗?

\n

Kew*_*ira 22

我遇到了这个问题。我的问题是我以错误的顺序导入:

@import '../node_modules/bootstrap/scss/mixins';
@import '../node_modules/bootstrap/scss/functions';
@import '../node_modules/bootstrap/scss/variables';
Run Code Online (Sandbox Code Playgroud)

我通过将其更改为摆脱了它

@import '../node_modules/bootstrap/scss/functions';
@import '../node_modules/bootstrap/scss/variables';
@import '../node_modules/bootstrap/scss/mixins';
Run Code Online (Sandbox Code Playgroud)

您需要按此特定顺序导入这三个内容。您可能缺少其中一项导入,或者也以错误的顺序编写了它。


Mar*_*ndy 0

我刚刚遇到这个问题。您还需要包含functions.css。

https://github.com/twbs/bootstrap/issues/23451