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

Running into the same problem here.

dan655t avatar Dec 28 '17 21:12 dan655t

Where ?

marshallcool avatar Dec 28 '17 21:12 marshallcool

bootstrap's 4.0.0 beta 3 came out today. Might have to downgrade to their beta 2 again to make it work. I am running into the same issue.

bryan-pegg23 avatar Dec 28 '17 22:12 bryan-pegg23

@bryan-pegg23 Thanks. Bootstrap was a problem in my case.

DamianKedzior avatar Dec 28 '17 23:12 DamianKedzior

The issue seems to be caused by this section of bootstrap's package.json file

 "browserslist": [
    "last 1 major version",
    ">= 1%",
    "Chrome >= 45",
    "Firefox >= 38",
    "Edge >= 12",
    "Explorer >= 10",
    "iOS >= 9",
    "Safari >= 9",
    "Android >= 4.4",
    "Opera >= 30"
  ],

The autoprefixer plugin uses this list and unless you have a version 7.0 or higher it does not support the last n major version syntax.

Upgrading autoprefixer should fix the issue.

RyanWillDev avatar Dec 28 '17 23:12 RyanWillDev

ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major

Same error, just started happening.

Autoprefixer is at 6.7.7 Boostrap 4.0.0 beta.2

package.json

{
  "name": "apm",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve -o --port 3913",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint --type-check",
    "e2e": "ng e2e",
    "build-prod": "ng build --prod --aot"
  },
  "private": true,
  "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.8",
    "angular-dual-listbox": "^4.4.0",
    "bootstrap": "^4.0.0-beta.2",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "jquery": "^1.9.1",
    "ng2-select": "^2.0.0",
    "ngx-progressbar": "^2.1.1",
    "ngx-toastr": "^6.5.0",
    "popper.js": "^1.12.3",
    "rxjs": "^5.4.1",
    "underscore": "^1.8.3",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.5.0",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^3.2.15",
    "@types/node": "~6.0.60",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.4.2"
  }
}

package-lock.json

"autoprefixer": {
      "version": "6.7.7",
      "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.7.7.tgz",
      "integrity": "sha1-Hb0cg1ZY41zj+ZhAmdsAWFx4IBQ=",
      "dev": true
    },
    "bootstrap": {
      "version": "4.0.0-beta.2",
      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.0.0-beta.2.tgz",
      "integrity": "sha512-DzGtdTlKbrMoGMpz0LigKSqJ+MgtFKxA791PU/q062OlRG0HybNZcTLH7rpDAmLS66Y3esN9yzKHLLbqa5UR3w=="
    },
 "postcss-loader": {
      "version": "1.3.3",
      "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-1.3.3.tgz",
      "integrity": "sha1-piHqH6KQYqg5cqRvVEhncTAZFus=",
      "dev": true
    },

ekwebster avatar Dec 28 '17 23:12 ekwebster

@ekwebster "bootstrap": "^4.0.0-beta.2" the caret here means it will update you to the most recent version, just try yarn upgrade [email protected] or npm update [email protected]

arturovt avatar Dec 28 '17 23:12 arturovt

@ekwebster It looks like the last n major versions syntax was added in browserList 2.4 and autoprefixer updated to version 2 of browserList in version 7.0.

So, any version of autoprefixer above 7.0 should work. I corrected my comment above.

RyanWillDev avatar Dec 28 '17 23:12 RyanWillDev

I have the same error

marcelolimabh avatar Dec 29 '17 02:12 marcelolimabh

Running into this issue as well trying to use the latest angular-cli "1.6.3" with the latest bootstrap "4.0.0-beta.2".

mythz avatar Dec 29 '17 02:12 mythz

Did you tried this? Same error and fixed by,

  • From "bootstrap": "^4.0.0-beta.2" to "bootstrap": "4.0.0-beta.2", take out "^"
  • Then npm install
  • Then ng serve

oopsmails avatar Dec 29 '17 04:12 oopsmails

Removing the caret ‘^’ did solve the problem

ekwebster avatar Dec 29 '17 06:12 ekwebster

I have the same issue instead i am getting warning.

WARNING in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":fal se,"precision":8,"includePaths":[]}!./src/style-sheets/theme/theme.scss (Emitted value instead of an instance of Error) postcss-custom-properties: C:\Users\krishna.chandra\Desktop\retail\ng-ui\src\style-sheets\theme\theme.scss:456:5: variable '--globalSub2' is undefined and u sed without a fallback NonErrorEmittedError: (Emitted value instead of an instance of Error) postcss-custom-properties: C:\Users\krishna.chandra\Desktop\retail\ng-ui\src\style-sheets\theme\theme.scss:456:5: variable '--globalSu b2' is undefined and used without a fallback at Object.emitWarning (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\webpack\lib\NormalModule.js:117:16) at result.warnings.forEach (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\postcss-loader\lib\index.js:149:49) at Array.forEach (native) at postcss.process.then (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\postcss-loader\lib\index.js:149:27) @ ./src/style-sheets/theme/theme.scss 4:14-208 @ multi ./node_modules/bootstrap/dist/css/bootstrap.min.css ./node_modules/primeng/resources/themes/omega/theme.css ./node_modules/primeng/resources/primeng.min.css ./src/style-sheets/theme/theme.scss ./ node_modules/font-awesome/css/font-awesome.css "4.0.0-beta.2" did not worked in my scenario.

krischandra avatar Dec 29 '17 06:12 krischandra

This does seem to be related to [email protected], and is also causing failures in our CI (https://travis-ci.org/angular/angular-cli/jobs/322676874).

filipesilva avatar Dec 29 '17 10:12 filipesilva

I was facing same issue. I downgraded bootstrap with following steps. Uninstall [email protected]: npm uninstall bootstrap --save Then installed [email protected]: npm install [email protected] --save

I did not remove ^ because package-lock.json will handle it.

ajinkya-vaze avatar Dec 29 '17 12:12 ajinkya-vaze

same problem here - on two different laptops. Why is beta.3 still up on their site ?

robertmazzo avatar Jan 01 '18 02:01 robertmazzo

I have fixed my package.json to:

"bootstrap": "4.0.0-beta.2" If you have an app at production environment I think the best practice is to use a stable and fixed version.

Steps:

1-Remove /node_modules 2-Fix the package.json file 3-Execute npm install 4-Enjoy!

sboxdeveloper avatar Jan 02 '18 10:01 sboxdeveloper

I downgraded bootstrap to "[email protected]" and the app back to work again

GhanemJR0 avatar Jan 03 '18 17:01 GhanemJR0

I'm also facing the same problem ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/bootstrap/dist/css/bootstrap.min.css

@ ./~/bootstrap/dist/css/bootstrap.min.css 4:14-127 @ multi ./~/bootstrap/dist/css/bootstrap.min.css webpack: Failed to compile.

UtsavPreet avatar Jan 04 '18 11:01 UtsavPreet

still happening - also today had to specify beta 2 as 3 will produce same error as above

ghost avatar Jan 05 '18 11:01 ghost