繁体   English   中英

当我尝试在我的 Angular 项目中添加引导程序时出现此错误

[英]I am getting this error when i try to add bootstrap in my Angular project

在此处输入图像描述

我也尝试使用以下命令,

ng add @ng-bootstrap/ng-bootstrap -- force

它没有用,所以我删除了node_modulespackage-lock.json文件。 我使用以下命令重新安装了它。

npm install --legacy-peer-deps

我仍然有同样的问题。 有人有想法吗?

我正在学习一个教程,这就是我必须使用这些命令的原因。 我用这个。

  • 我只需要在你的 angular 14 上安装引导程序并将 css 文件导入 style.css 文件。 这仅适用于 css 导入。 所以你可以运行下面的命令:

npm install bootstrap --save

  • 然后我在 style.css 文件中导入了 bootstrap css,如下所示:

@import "~bootstrap/dist/css/bootstrap.css";

参考链接

You simpley do 

npm install bootstrap

and then map the respected soure location into your angular.json file 

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

And restart your app 
or
You can try with ngx also

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM