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

Angular全局导入Bootstrap SCSS时提示“Error: Can't find stylesheet to import.”的问题咨询

Angular全局导入Bootstrap SCSS时提示“Error: Can't find stylesheet to import.”的问题咨询

各位好,我在Angular项目里遇到了个棘手的问题,想请教下大家:

我在项目的styles.scss文件里添加了这句导入代码:

@import "bootstrap/scss/bootstrap";

结果直接弹出错误提示:Error: Can't find stylesheet to import.

我的Angular项目结构大致如下:

--src
  --app
  --styles.scss
--angular.json

另外,angular.json里和样式、脚本相关的配置是这样的:

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/styles.css"
],
"scripts": ["node_modules/bootstrap/dist/js/bootstrap.min.js"]

我已经尝试过修改@import语句里的路径,试图让它匹配node_modules文件夹里Bootstrap的实际存放位置,但问题还是没解决。有没有朋友知道这到底是哪里出问题了呀?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.08 14:38:03