繁体   English   中英

Angular-CLI构建到生产引导错误

[英]Angular-cli build to production bootstrap error

我正在尝试构建一个Angular 5项目以部署到IIS。

当我运行以下命令时:

ng build --prod

我收到以下错误:

./node-modules/bootstrap/dist/css/bootstrap.min.css中的错误。

模块构建失败:BrowserslistError:未知的专业浏览器。

我读到此错误,看到一个建议的解决方案是将Angular CLI升级到1.7.0或更高版本。 我的CLI版本是1.7.3,Bootstrap版本是4.0.0。

如何解决此错误,以便构建解决方案?

https://github.com/angular/angular-cli/issues/9020在这里提到了这个问题,但通常不会在angular cli v1.7.0中出现

尝试其他解决方法:

.angular-cli.json的样式部分中删除“ ../node_modules/bootstrap/dist/css/bootstrap.min.css”。

尝试将Bootstrap的CSS直接包含在全局styles.css文件中

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

styles.scss文件

@import "~bootstrap/scss/bootstrap";

您正在使用哪个版本的引导程序? 我在4.1.2中遇到了同样的问题,将其更改为4.1.1,终于可以了!

暂无
暂无

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

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