简体   繁体   English

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

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

在此处输入图像描述

I tried using following command too,我也尝试使用以下命令,

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

It didnt worked, so i deleted both node_modules and package-lock.json files.它没有用,所以我删除了node_modulespackage-lock.json文件。 I reinstalled it using following command.我使用以下命令重新安装了它。

npm install --legacy-peer-deps

Still i am having the same problem.我仍然有同样的问题。 Anyone have an idea?有人有想法吗?

I was following a tutorial, thats why i had to use those commands.我正在学习一个教程,这就是我必须使用这些命令的原因。 insted i used this.我用这个。

  • I had to just install bootstrap on your angular 14 and import css file to style.css file.我只需要在你的 angular 14 上安装引导程序并将 css 文件导入 style.css 文件。 this is only for css importing.这仅适用于 css 导入。 so you can run command bellow:所以你可以运行下面的命令:

npm install bootstrap --save npm install bootstrap --save

  • then i imported bootstrap css on style.css file as like bellow:然后我在 style.css 文件中导入了 bootstrap css,如下所示:

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

Referance link 参考链接

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.

相关问题 当我尝试创建一个新的 angular 项目时出现以下错误 - I am getting following error when I try to create a new angular project 当我尝试运行我的 angular 项目时,我收到这些错误 - when i try to run my angular project i get these error 为什么将我的 Angular 项目部署到 Heroku 时出现 ng not found 错误? - Why am I getting an ng not found error when deploying my Angular project to Heroku? 当我尝试使用带有 angular 应用程序的 ckeditor5 构建生产版本时出现错误 - I am getting an error when I try to build the production build using the ckeditor5 with angular app 当我尝试创建新的 Angular 项目并尝试安装 scss 时,出现错误 - when I am trying to creating new Angular project and trying to install scss, I am getting error 当我尝试执行现有的 Angular 项目时出现此错误 - I'm getting this error when I try to execute an existing Angular project 当我尝试运行我的 angular 项目时,我的浏览器上出现“无法访问此站点” - I am getting "This site can’t be reached" on my browser when I am trying to run my angular project 在我的angular 2应用程序中集成bootstrap 4 popover时出现错误 - I am getting error while integrating bootstrap 4 popover in my angular 2 application 当我尝试创建项目并运行Angular 6时,出现错误 - When I try to create a project and run Angular 6, I get an error 我在我的项目中正常使用angular的最新版本中的Mat Autocomplete并得到这种类型的错误 - I am using Mat Autocomplete in angular's latest version using it normally in my project getting this type of error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM