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
I upgraded to @angular/[email protected], created a new project, added bootstrap@^4.0.0 and I was able to start the app with bootstrap.min.css plumbed in by adding it as an @import to my styles.css. I was also able to start my app by plumbing it in via the .angular-cli.json by adding it to the styles.
A gotcha here would be to make sure you upgrade your global and your app to @angular/cli to 1.7.0-beta.1 and double check that it actually upgraded by running ng --version (mine didn't so I had to manually remove and reinstall it for some reason).
I had the same problem. this is because 4.0.0-beta.3 .please downgrade it to 4.0.0-beta.2 Detailed steps: In you pakage.json "bootstrap": "^4.0.0-beta.2" replace it with "bootstrap": "4.0.0-beta.2" ( remove the carrot sign) npm uninstall npm install This must fix it.
Just upgrade from 4.0.0-beta to 4.0.0 and experienced this problem with ng serve. Went back to 4.0.0-beta and ng serve is ok. This issue shouldn't be closed if it's a cli issue.
Simply upgrading to @angular/[email protected] solved the problem for me, like @Jimeh87 proposed.
@dduft But were we not informed ng cli 1.6.4+ would fix this issue, and on 1.6.4, I remember it was fixed.
Now on 1.6.5 and issue rears its ugly head. Is the CLI retrogressing?
@pranaysand The idea to downgrade doesn't ring well in my ears. On 1.6.3, it couldn't work with bootstrap 4.0.0-beta.3, so it had to be downgraded to work.
Now, on 1.6.5, to work, we need to downgrade to a beta of bootstrap?
Development builds were fixed. Production builds required additional changes which were already present but are only available in 1.7 (currently in beta). The stylesheet optimization pipeline was rewritten providing both increased performance and fixing multiple underlying issues. This however cannot be published in a patch release hence its presence in 1.7 and not 1.6.x.
cli 1.7.0-beta.1 fixes the issue when using the latest released bootstrap (4.0.0) (not beta) as well.
Just globally update your angular/cli before starting a new project: npm i -g @angular/cli It works with beta 3, too !
Hi all! I read all of yours comment and after I follow most of logs that the npm leave on my console (after a boring fight with bootstrap), so I uninstall and reinstall: npm uninstall bootstrap --save subsequently npm install [email protected] --save so I see in the console: this warning:
npm WARN [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer depe ndencies yourself. npm WARN [email protected] requires a peer of popper.js@^1.12.3 but none is installed. You must install peer dep endencies yourself.
I follow the suggest, so npm install [email protected] --save and npm install popper.js@^1.12.3 --save finally: npm install and ng serve and IT WORK!!!
It's work.Thanks
Updated bootstrap to 4.0.0 "stable" today in hopes of this being fixed => it isn't
Followed @jameskentTX advice and deleted the suspect lines from bootstrap's package.json. Now it works.
This is very hacky though.
I'm using bootstrap 4.0.0 with CLI v 1.6.5. I'm still getting this error
Using Angular CLI 1.7.0 beta 2 worked for me today. Thank you to everyone who mentioned it! 💯
Anyone using cli 1.7.0 betas may have issues with 404s / blank pages when reloading the page, e.g. when using ng serve, as there's a cli bug. I've put a work around on this ticket: https://github.com/angular/angular-cli/issues/9297
I tried [email protected] with Angular CLI 1.6.6 (local and global), and it worked fine.
i used [email protected] and @angular/[email protected] and still not working
Step 1.
Inside .angular-cli.json
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
]
Remove "../node_modules/bootstrap/dist/css/bootstrap.min.css"
Step 2.
Go to styles.css
Import bootstrap by adding this line
@import "~bootstrap/dist/css/bootstrap.css";
These steps solved the errors I got during the building process.
Have the same problem.
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/bootstrap/dist/css/bootstrap.min.css
Module build failed: BrowserslistError: Unknown browser major
at error (E:\notWork\angular4Course\directives-deep\node_modules\browserslist\index.js:37:11)
...
I just started to learn Angular, I don't need bootstrap 4. I just want the simplest solution to make my project alive again. So I downgraded a bootstrap.
- In
package.jsonfile I changed to"bootstrap": "3.3.7", - then run
npm install - after that
ng serve --open
I'm using bootstrap 4.0.0 with CLI v 1.6.3.
@import "~bootstrap/scss/bootstrap";
This worked for me.
The "BrowserslistError: Unknown browser major scss" bug is still happening in the latest bootstrap 4.0.0 and CLI 1.6.6, to solve the issue i had to downgrade bootstrap to 4.0.0-beta.2 without the caret with the caret got the same error as well.