You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 13引入kendo-theme-bootstrap报SassError: $color: null is not a color

解决Angular 13中kendo-theme-bootstrap的Sass颜色空值错误

针对你遇到的SassError: $color: null is not a color错误,可通过以下几种配置调整修复:

  • 匹配主题与Angular版本
    Angular 13需搭配对应版本的kendo-theme-bootstrap,建议锁定主题版本为^5.12.0(该版本与Angular 13兼容性稳定),更新package.json中的依赖后重新安装。

  • 调整SCSS导入顺序
    确保在导入Kendo主题前先加载Bootstrap的SCSS变量文件,让Kendo能正确读取Bootstrap的颜色变量:

    // 先导入Bootstrap变量
    @import "~bootstrap/scss/variables";
    // 再导入Kendo主题
    @import "~@progress/kendo-theme-bootstrap/scss/all";
    
  • 显式声明缺失的颜色变量
    如果项目未完整引入Bootstrap变量,手动声明Kendo主题依赖的核心颜色变量,避免出现null值:

    // 声明必要的Bootstrap颜色变量
    $primary: #0d6efd;
    $secondary: #6c757d;
    $success: #198754;
    $info: #0dcaf0;
    $warning: #ffc107;
    $danger: #dc3545;
    
    // 导入Kendo主题
    @import "~@progress/kendo-theme-bootstrap/scss/all";
    
  • 清理依赖与缓存
    执行以下命令清理可能存在的缓存和损坏依赖:

    rm -rf node_modules package-lock.json
    npm install
    ng cache clean --all
    

内容的提问来源于stack exchange,提问作者NItesh Shrestha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 18:53:17