0

I'm trying to build an Angular 5 project for deployment to IIS.

When I run the following command:

ng build --prod

I get the following error:

Error in ./node-modules/bootstrap/dist/css/bootstrap.min.css.

Module build failed: BrowserslistError: Unknown browser major.

I read about this error and saw a suggested solution is to upgrade your Angular CLI to 1.7.0 or newer. My CLI version is 1.7.3 and Bootstrap version is 4.0.0.

How do I fix this error so that I can build my solution?

6
  • Try to delete caret ‘^’ of the bootstrap entry in the package.json Commented Mar 29, 2018 at 13:22
  • Have you attempted updating the Angular CLI globally? github.com/angular/angular-cli#updating-angular-cli Commented Mar 29, 2018 at 13:23
  • I tried to delete the caret - still not working. @ForestG Commented Mar 29, 2018 at 13:29
  • My global cli is up to date (1.7.3) and I run the build from global cli. @ShellNinja Commented Mar 29, 2018 at 13:30
  • How do you include bootstrap's css? Commented Mar 29, 2018 at 13:32

2 Answers 2

5

That issue is mentionned here https://github.com/angular/angular-cli/issues/9020 but should normally not occur in angular cli v1.7.0

Try the other workaround:

Remove "../node_modules/bootstrap/dist/css/bootstrap.min.css" from the styles section in .angular-cli.json.

Try including bootstrap's css directly in your global styles.css file

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

or styles.scss file

@import "~bootstrap/scss/bootstrap";
Sign up to request clarification or add additional context in comments.

Comments

0

What version of bootstrap are you using?? I've the same issue with 4.1.2 and I changed it to 4.1.1, finally it's working!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.