BrowserslistError: Unknown browser major

后端 未结 9 1613
南旧
南旧 2020-12-15 07:30

I\'m trying to use bootstrap 4 with my angular installation. i\'ve run npm install --save bootstrap@next but i have a break at runtime :

./node_modules/css-l         


        
相关标签:
9条回答
  • 2020-12-15 07:56

    It works now without workaround with Angular CLI: 1.6.5. Angular CLI has been depending on an incompatible version of autoprefixer (https://github.com/angular/angular-cli/issues/9020)

    Verify version by typing ng --version. Do not foget to update your dev dependency in package.json:

    "@angular/cli": "1.6.5",
    
    0 讨论(0)
  • 2020-12-15 07:57

    Was having same issue changed my dependency in package.json from this

    "dependencies": {
        "@angular/animations": "^5.0.0",
        "@angular/common": "^5.0.0",
        "@angular/compiler": "^5.0.0",
        "@angular/core": "^5.0.0",
        "@angular/forms": "^5.0.0",
        "@angular/http": "^5.0.0",
        "@angular/platform-browser": "^5.0.0",
        "@angular/platform-browser-dynamic": "^5.0.0",
        "@angular/router": "^5.0.0",
        "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.9",
        "bootstrap": "^4.0.0-beta.3",
        "core-js": "^2.4.1",
        "font-awesome": "^4.7.0",
        "zone.js": "^0.8.14"
      }
    

    to (changing "bootstrap": "4.0.0-beta.2" to a stable version)

    "dependencies": {
        "@angular/animations": "^5.0.0",
        "@angular/common": "^5.0.0",
        "@angular/compiler": "^5.0.0",
        "@angular/core": "^5.0.0",
        "@angular/forms": "^5.0.0",
        "@angular/http": "^5.0.0",
        "@angular/platform-browser": "^5.0.0",
        "@angular/platform-browser-dynamic": "^5.0.0",
        "@angular/router": "^5.0.0",
        "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.9",
        "bootstrap": "4.0.0-beta.2",
        "core-js": "^2.4.1",
        "font-awesome": "^4.7.0",
        "zone.js": "^0.8.14"
      },
    

    then,run: npm install ng serve

    problem solved.!!

    0 讨论(0)
  • 2020-12-15 07:58

    I had the same problem with Bootstrap 4.1.1. Solution is to change Boostrap version to 4.0.0-beta.2 (without the caret) in package.json then run

    npm install 
    ng serve
    

    And also add import "~bootstrap/dist/css.bootstrap.css" in your style.css file.

    0 讨论(0)
提交回复
热议问题