angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

BrowserslistError: Unknown browser major at error

Open marshallcool opened this issue 8 years ago • 93 comments

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

marshallcool avatar Dec 28 '17 21:12 marshallcool

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...

thejimgaudet avatar Jan 05 '18 15:01 thejimgaudet

This should be fixed on Angular CLIs side in the next release (1.6.4). That should be next week.

filipesilva avatar Jan 05 '18 15:01 filipesilva

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.

thdavids07 avatar Jan 05 '18 16:01 thdavids07

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

Domer79 avatar Jan 06 '18 08:01 Domer79

I have the same problem too.

beginor avatar Jan 07 '18 03:01 beginor

Same problem here and @Domer79 's solution does not work, the angular CLI shows the same error

Meowzz95 avatar Jan 07 '18 05:01 Meowzz95

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 avatar Jan 10 '18 10:01 jameskentTX

@jameskentTX provided me with the workaround. Except the filename is package.json in the node_modules/bootstrap folder for me.

bmrana avatar Jan 10 '18 17:01 bmrana

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.

demoalbe avatar Jan 12 '18 09:01 demoalbe

CLI 1.6.4 does not fix the problem.

greuff avatar Jan 12 '18 09:01 greuff

CLI 1.6.4 fixed the problem for me.

PetrBainar avatar Jan 12 '18 11:01 PetrBainar

The error persist only in production builds.

dinerotah avatar Jan 12 '18 15:01 dinerotah

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

MegaFy avatar Jan 15 '18 00:01 MegaFy

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.

ernitishkumar avatar Jan 15 '18 08:01 ernitishkumar

You must combine @megafy and @jameskentTX solution

ibagaric avatar Jan 15 '18 10:01 ibagaric

Can you try @angular/[email protected] instead please? See https://github.com/angular/angular-cli/issues/9029#issuecomment-357267439 for more details.

filipesilva avatar Jan 15 '18 12:01 filipesilva

@filipesilva Yes using @angular/[email protected] fix the issue.

dinerotah avatar Jan 15 '18 16:01 dinerotah

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

ismailbaig avatar Jan 17 '18 15:01 ismailbaig

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';

KostyaTretyak avatar Jan 18 '18 14:01 KostyaTretyak

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.

RowSolAdmin avatar Jan 20 '18 13:01 RowSolAdmin