BrowserslistError: Unknown browser major at error
I just deleted the node_modules folder and put the packages back
macOs Node 8 node: 8 "@angular/common": "^5.0.0", "@angular/compiler": "^5.0.0", "@angular/compiler-cli": "^5.0.0", "@angular/core": "^5.0.0", "@angular/forms": "^5.0.0", "@angular/http": "^5.0.0", "@angular/cli": "^1.5.0", "@angular/compiler-cli": "^5.0.0",
Error:
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/bootstrap/dist/css/bootstrap.min.css
Module build failed: BrowserslistError: Unknown browser major
at error (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:37:11)
at Function.browserslist.checkName (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:320:18)
at Function.select (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:438:37)
at /Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:207:41
at Array.forEach (native)
at browserslist (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:196:13)
at Browsers.parse (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/browsers.js:44:14)
at new Browsers (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/browsers.js:39:28)
at loadPrefixes (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/autoprefixer.js:56:18)
at plugin (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/autoprefixer.js:62:18)
at LazyResult.run (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:270:20)
at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:185:32)
at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:197:22)
at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:197:22)
at processing.Promise.then._this2.processed (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:224:20)
at LazyResult.async (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:221:27)
@ ./node_modules/bootstrap/dist/css/bootstrap.min.css 4:14-131
@ multi ./src/styles.scss ./src/select.css ./node_modules/bootstrap/dist/css/bootstrap.min.css ./node_modules/font-awesome/css/font-awesome.min.css ./node_modules/primeng/resources/primeng.min.css ./node_modules/primeng/resources/themes/omega/theme.css ./node_modules/material-design-icons/iconfont/material-icons.css
A workaround here on SO (https://stackoverflow.com/questions/48034051/bootstrap-4-beta-3-throws-error-with-angular-cli). Will need to re-run each time you upgrade, until the next version of CLI that updates autoprefixer to latest...
This should be fixed on Angular CLIs side in the next release (1.6.4). That should be next week.
Thanks you, for the moment I copy manually the files of bootstrap beta 3 for beta 2 in my project "proy\node_modules\bootstrap\dist\css" and It could render normally Because I need use some styles that beta 2 do not has.
I changed the path to bootstrap.scss @import "~ bootstrap / scss / bootstrap.scss"; in the styles.scss file. And solved this problem Also adding packages node-sass and sass-loader
I have the same problem too.
Same problem here and @Domer79 's solution does not work, the angular CLI shows the same error
You can use Bootstrap 4 beta 3, but first edit package.json in node_modules/bootstrap:
"browserslist": [ "last 1 major version", <----- delete this line ">= 1%", <----- delete this line "Chrome >= 45", "Firefox >= 38", "Edge >= 12", "Explorer >= 10", "iOS >= 9", "Safari >= 9", "Android >= 4.4", "Opera >= 30" ],
@jameskentTX provided me with the workaround. Except the filename is package.json in the node_modules/bootstrap folder for me.
Hi!
I upgraded to release 1.6.4, but i'm always facing the problem, using [email protected].
Unfortunately I need to use that version of bootstrap because it fixes another problem.
I'll try the workaround proposed some days ago, but I hope in a "cleaner" solution.
Thank you for the support.
CLI 1.6.4 does not fix the problem.
CLI 1.6.4 fixed the problem for me.
The error persist only in production builds.
Temp Fix
- change style.css file to style.scss
- change style.css reference in .angular-cli.json to style.scss
- in style.scss import @import '~bootstrap/scss/bootstrap.scss';
Should work
CLI 1.6.4 does not fix the issue !! But after applying workaround by @jameskentTX its working. Since we wanted the beta 3 build of bootstrap in our project we have to use this workaround till Angular CLI fixes the issue.
You must combine @megafy and @jameskentTX solution
Can you try @angular/[email protected] instead please? See https://github.com/angular/angular-cli/issues/9029#issuecomment-357267439 for more details.
@filipesilva Yes using @angular/[email protected] fix the issue.
Even i am facing the same issue.
package.json { ... ...
"ngx-bootstrap": "^1.9.3", ... ... }
package-lock.json { ... "autoprefixer": "6.7.7", ... }
not able to resolve it. Any help
I have @angular/[email protected] but this problem has not disappeared. I noticed that problems arise inside src/styles.css and with @import '~any/lib/here.css';. That is, not depending on the library, if it is imported in this way. The main thing is that in the beginning there was a tilda.
/* This not works */
@import '~highlight.js/styles/default.css';
@import '~highlight.js/styles/googlecode.css';
@import '~font-awesome/css/font-awesome.min.css';
@import '~katex/dist/katex.min.css';
/* This works */
@import 'assets/css/angular.css';
@import 'assets/css/blog.css';
Hit same issues defined above using cli 1.6.5 whilst trying to perform a production build.
Temp fix suggested by @jameskentTX above allowed production build to run.