为什么我会得到;预期数字“;尝试使用Rollup和POSTSS从物料导入Sass变量时?

为什么我会得到;预期数字“;尝试使用Rollup和POSTSS从物料导入Sass变量时?,sass,material-design,rollup,postcss,Sass,Material Design,Rollup,Postcss,我有以下代码 @use "@material/top-app-bar/_variables.import" as mdc; .color{ background-color: lightblue; height: mdc.$row-height; } 但是当我跑的时候我得到 错误:应为数字。 src/components/header/index.style.scss 4:17根样式表 我猜我导入的Sass文件不正确。我试过 @use "@material/top-app-ba

我有以下代码

@use "@material/top-app-bar/_variables.import" as mdc;
.color{
    background-color: lightblue;
    height: mdc.$row-height;
}
但是当我跑的时候我得到

错误:应为数字。
src/components/header/index.style.scss 4:17根样式表

我猜我导入的Sass文件不正确。我试过

@use "@material/top-app-bar/variables";
.color{
    background-color: lightblue;
    height: variables.$row-height;
}

@use "@material/top-app-bar/mdc-top-app-bar";
.color{
    background-color: lightblue;
    height: $mdc-top-app-bar-row-height;
}
等等。。。但我尝试的都不管用。如何使用sass导入变量

更新

我进一步注意到了这一点

[!](插件POSTSS)错误:应为数字

src/components/header/index.style.scss 9:29根样式表

这可能是一个汇总插件问题吗

更新2

看起来问题的一部分是安装node sass包。现在我得到

[!](插件postcss)错误:“…ight:variables”后的CSS无效:预期表达式(例如1px,粗体)为“$行高”

当我运行以下命令时

@use "@material/top-app-bar/variables" as variables;
.color{
    background-color: lightblue;
    height: variables.$row-height;
}
我还尝试了更简单的方法

// ./_variables.scss
$row-height: 64px !default;

@use "./variables";
.color{
    background-color: lightblue;
    height: variables.$row-height;
}

我仍然得到了同样的结果。

我在使用sass颜色模块时遇到了类似的问题

我不得不将以下内容添加到我的
rollup.config.js

从“汇总插件sass”导入sassPlugin
从“sass”导入sass
sassPlugin({
运行时:sass,
//为简洁起见,省略了其他属性。
})