Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module build failed: BrowserslistError: Unknown browser query dead #266

Closed
Prabhagar06 opened this issue Jun 1, 2018 · 81 comments
Closed

Module build failed: BrowserslistError: Unknown browser query dead #266

Prabhagar06 opened this issue Jun 1, 2018 · 81 comments

Comments

@Prabhagar06
Copy link

@Prabhagar06 Prabhagar06 commented Jun 1, 2018

error

Could you please help me

@ai
Copy link
Member

@ai ai commented Jun 1, 2018

It happpens because of old cssnano (it uses old Browserslist without dead query).

We are triting to release cssnano 4 (with new Browserslist) ASAP

@ai
Copy link
Member

@ai ai commented Jun 1, 2018

What you can do right now:

  1. Disable CSS minimization in webpack. Just use webpack csso plugin.
  2. Wait for cssnano 4 release
@Prabhagar06
Copy link
Author

@Prabhagar06 Prabhagar06 commented Jun 4, 2018

Can you please explain how to disable CSS minimization in webpack? because i am new to this.
Thanks

@ai
Copy link
Member

@ai ai commented Jun 4, 2018

@Prabhagar06 show your webpack config

@Prabhagar06
Copy link
Author

@Prabhagar06 Prabhagar06 commented Jun 5, 2018

Ya. I have done it myself. thanks

@SidV7
Copy link

@SidV7 SidV7 commented Jun 20, 2018

Hello @Prabhagar06 @ai could you please provide the steps to disable the CSS minimization in webpack as I'm facing the same issue.

@ai
Copy link
Member

@ai ai commented Jun 20, 2018

Try to pass:

{
  loader: 'css-loader',
  options: {
    minimize: false
  }
}
@SidV7
Copy link

@SidV7 SidV7 commented Jun 20, 2018

Included the above code in webpack.config.js under node_modules/xxhashjs/webpack.config.js but did not resolve the issue. Sorry i'm new to this. Could you please direct if i'm making the changes at the correct place? Thanks

var path = require("path")
module.exports = {
"entry": "./lib/index.js"
, "output": {
"path": __dirname + "/build"
, "filename": "xxhash.js"
, "library": "XXH"
, "libraryTarget": "umd"
}
,"loader":'css-loader'
,"options": {
minimize: false
}
}

@ai
Copy link
Member

@ai ai commented Jun 20, 2018

@SiddarthVaikunthe sorry, ask webpack team for it ;)

@Splaktar
Copy link

@Splaktar Splaktar commented Jun 25, 2018

If you are seeing this with the autoprefixer default settings (which include not dead), then you can work around it by using the following string:

> 0.5%, last 2 versions, Firefox ESR, not ie <= 10, not ie_mob <= 10, not bb <= 10, not op_mob <= 12.1
@ai
Copy link
Member

@ai ai commented Jul 7, 2018

Update css-loader to 1.0.0. It will fix this problem with unknown queries.

@ai ai closed this Jul 7, 2018
@juanr2001
Copy link

@juanr2001 juanr2001 commented Jul 12, 2018

This is not closed, this issue is happening...

./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/lib??ref--6-2!./node_modules/bootstrap/dist/css/bootstrap.css Module build failed: BrowserslistError: Unknown browser query dead at /project/node_modules/browserslist/index.js:164:11 at Array.reduce (<anonymous>) at resolve (/project/node_modules/browserslist/index.js:132:18) at browserslist (/project/node_modules/browserslist/index.js:224:16) at Browsers.parse (/project/node_modules/autoprefixer/lib/browsers.js:61:16) at new Browsers (/project/node_modules/autoprefixer/lib/browsers.js:52:30) at loadPrefixes (/project/node_modules/autoprefixer/lib/autoprefixer.js:70:24) at plugin (/project/node_modules/autoprefixer/lib/autoprefixer.js:81:24) at LazyResult.run (/project/node_modules/postcss/lib/lazy-result.js:277:20) at LazyResult.asyncTick (/project/node_modules/postcss/lib/lazy-result.js:192:32) at LazyResult.asyncTick (/project/node_modules/postcss/lib/lazy-result.js:204:22) at /project/node_modules/postcss/lib/lazy-result.js:197:27 at <anonymous> @ ./node_modules/bootstrap/dist/css/bootstrap.css 4:14-128 13:3-17:5 14:22-136 @ ./src/main.js @ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/main.js

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

@juanr2001 Show your npm ls

@tncho
Copy link

@tncho tncho commented Jul 12, 2018

I'm encountering the same issue with Angular 5.2

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

@tncho are you sure that Angular 5.2 uses css-loader 1.0?

@tncho
Copy link

@tncho tncho commented Jul 12, 2018

@ai honestly I'm not sure, but I think not since I'm not seeing that dependency in the package / package-lock .json. The error in my case goes like this:

ERROR in ./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser query 'dead' at C:\Users\tncho\Documents\projects\webapp\node_modules\br owserslist\index.js:164:11
do you happen to know what's wrong here? Thanks!

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

@tncho to fix this issue you must start to use css-loader 1.0.

Check your npm ls, find who load old Browserslist (before 3.0). Update the dependency.

@nicksterx
Copy link

@nicksterx nicksterx commented Jul 12, 2018

It looks like @angular/cli@1.7.4 has a dependency on autoprefixer@7.2.6 which has a dependency on browserslist@2.11.3

@bjohndev
Copy link

@bjohndev bjohndev commented Jul 12, 2018

This just started happening for me today after I manually deleted my npm_modules folder and ran npm install. Now when I try to run ng serve. I get the error below.

ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser query dead``

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

@bjohndev Check your npm ls, find who load old Browserslist (before 3.0). Update the dependency.

@bjohndev
Copy link

@bjohndev bjohndev commented Jul 12, 2018

@ai This is the same issue that @nicksterx mentioned. "It looks like @angular/cli@1.7.4 has a dependency on autoprefixer@7.2.6 which has a dependency on browserslist@2.11.3" , what command should I run to update which dependency?

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

@bjohndev current version is 6.0.8 😏.

Update @angular/cli in your package.json and then call npm update.

I recommend to use Yarn instead of npm since Yarn has very useful tool yarn upgrade-interactive --latest

@bjohndev
Copy link

@bjohndev bjohndev commented Jul 12, 2018

Thanks @ai below is my package.json. I'm not sure what to change there.

{ "name": "ey-tax-severance-tax-tool-cli", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^5.2.0", "@angular/cdk": "^5.2.0", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", "@angular/material": "^5.2.0", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", "@angular/router": "^5.2.0", "@types/jspdf": "^1.1.31", "adal-angular4": "^2.0.16", "applicationinsights-js": "^1.0.18", "autotable": "^1.0.0", "bootstrap": "^4.1.1", "core-js": "^2.4.1", "font-awesome": "^4.7.0", "jquery": "^1.9.1", "jspdf": "^1.4.0", "jspdf-autotable": "^2.3.4", "jss": "^2.1.0", "popper.js": "^1.14.3", "primeng": "^5.2.6", "rxjs": "^5.5.6", "zone.js": "^0.8.19" }, "devDependencies": { "@angular/cli": "~1.7.3", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "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": "~4.1.0", "tslint": "~5.9.1", "typescript": "~2.5.3" } }

@nicksterx
Copy link

@nicksterx nicksterx commented Jul 12, 2018

@bjohndev Do you have another dev on your team with a working build? If you do can you take their package-lock.json? That's what I did to get to a working state but trying to figure out which package changed to break everything.

@ai
Copy link
Member

@ai ai commented Jul 12, 2018

Look into npm ls again and try to find the first dependency, which bring you old Browserslist. Maybe they're is a dependency above @angular/cli in dependencies tree. You maybe need to update it or to create a issue and ask developer to update @angular/cli.

I am not Angular user, so I can't give you direct instructions. You can try to ask people in Angular slack to help you.

@bjohndev
Copy link

@bjohndev bjohndev commented Jul 12, 2018

@nicksterx I have my package-lock.json in source control. I'll have to look at that to see if I can determine what is happening. I have several projects setup without this problem.

@nicksterx
Copy link

@nicksterx nicksterx commented Jul 12, 2018

Figured it out! Bootstrap 4.1.2 is breaking things. They released it 6 hours ago. Not sure what is broken but changing my package.json bootstrap to 4.1.1 fixes it.

@bjohndev
Copy link

@bjohndev bjohndev commented Jul 12, 2018

@nicksterx I'll give this a try

@browserslist browserslist deleted a comment from paolocavanna Oct 31, 2018
@paolocavanna
Copy link

@paolocavanna paolocavanna commented Oct 31, 2018

@ai you're totally right. Mine was just a temporary patch on a a project I'm working on and I didn't take into consideration the (now evident) trade offs.

@efectusmagnus
Copy link

@efectusmagnus efectusmagnus commented Dec 4, 2018

Just run 'npm install latest' in Git Bash (the terminal) to fix the problems.

@ai
Copy link
Member

@ai ai commented Dec 5, 2018

@Graphap fix the source of the problem, not result. You need to update Browserslist in all components. By removing not dead you did not fix the problem. In your system different companies still use different browsers. It will create problems in different places.

@browserslist browserslist deleted a comment from najandhamed Dec 5, 2018
@nicksterx
Copy link

@nicksterx nicksterx commented Dec 5, 2018

@ai Because this was fixed in bootstrap 4.1.3 should this thread be locked? These are a lot of solutions being suggested that are not helpful and probably confusing.

@ai
Copy link
Member

@ai ai commented Dec 5, 2018

I do not like blocked issue. For my point of view, it is not welcome and should be used only to prevent conflict

@revskill10
Copy link

@revskill10 revskill10 commented Feb 21, 2019

Why people're relating bootstrap to browserlist issue ?

@ai
Copy link
Member

@ai ai commented Mar 14, 2019

@juliusdejon I deleted your commit because it could force junior developers to use for dangerous solutions.

if your app is made by create-react-app, check your package.json you will see an array of browsersLists. just remove the not dead at the list

You will fix the symptom but not the source of the problem.

Some of your dependency uses old Browserslist. It means, that even without new not dead command, the same Browserslist config generates different target browsers for new and old tools. It is dangerous and could create other problems.

The real solution:

  1. Run npm update
  2. If you still have error call npm ls and found who use Browserslist < 3.
  3. Write to this project to update Browserslist.
@browserslist browserslist deleted a comment from juliusdejon Mar 14, 2019
@juliusdejon
Copy link

@juliusdejon juliusdejon commented Mar 14, 2019

├─┬ caniuse-api@1.6.1
│ │ │ │ │ ├─┬ browserslist@1.7.7
i found it

@ai
Copy link
Member

@ai ai commented Mar 14, 2019

@juliusdejon the latest caniuse-api is 3.0. Find who use such old caniuse-api dependency.

@SharmilaU-Hexaware
Copy link

@SharmilaU-Hexaware SharmilaU-Hexaware commented Jul 1, 2019

@bjohndev and @ai . Below issue is not resolved for me
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/ngx-bootstrap/datepicker/bs-datepicker.css
Module build failed: BrowserslistError: Unknown browser query dead

This is not resolved for me, I verified my code and it has browserslist = 2.11.3, autoprefixer = 7.2.3, angularcli=1.7.4

I modified the bootstrap version = 4.1.1 and ^4.1.3 and tried .Still it has issues. Its not allowing me to do ng serve.Please suggest solution to resolve this.

@vipulgupta2048
Copy link

@vipulgupta2048 vipulgupta2048 commented Jul 1, 2019

@SharmilaU-Hexaware
Maybe you can try this blog post for a possible solution if you haven't yet - https://mixstersite.wordpress.com/2019/02/03/solved-module-build-failed-browserslisterror-unknown-browser-query-dead-react-npm/

It helped me out, so I wrote about it.

@SharmilaU-Hexaware
Copy link

@SharmilaU-Hexaware SharmilaU-Hexaware commented Jul 1, 2019

@vipulgupta2048 .Thanks for the suggestion. i have seen that earlier when i was exploring the possible answers. It didnt resolve my problem.
my package.json dependencies
"dependencies": {
"@angular/animations": "^5.2.11",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@nicky-lenaers/ngx-scroll-to": "^0.6.1",
"angular-material": "^1.1.10",
"angular-mentions": "^1.0.2",
"bootstrap": "4.1.1",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"echarts": "^4.1.0",
"font-awesome": "^4.7.0",
"install": "^0.12.1",
"jquery": "^3.3.1",
"material-design-icons": "^3.0.1",
"md-select": "0.0.1-alpha.1",
"moment": "^2.22.2",
"ng-diff-match-patch": "^3.0.1",
"ng2-ace-editor": "^0.3.7",
"ng2-dragula": "^1.5.0",
"ng2-pdf-viewer": "^5.2.4",
"ngx-bootstrap": "^2.0.5",
"ngx-date-picker": "0.0.24",
"ngx-doc-viewer": "^0.1.19",
"ngx-document-view": "^1.0.1",
"ngx-echarts": "^2.1.0",
"ngx-editor": "^3.3.0",
"ngx-loading": "^1.0.14",
"ngx-pagination": "^3.1.1",
"ngx-spinner": "^6.0.0",
"node-sass": "^4.12.0",
"npm": "^6.3.0",
"pipe": "^1.1.0",
"popper.js": "^1.12.3",
"rxjs": "^5.5.6",
"sha1": "^1.1.1",
"toastr": "^2.1.4",
"xmlrpc": "^1.3.2",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular/cli": "~1.7.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@fortawesome/fontawesome-free": "^5.8.2",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"lato-font": "^3.0.0",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}

@revskill10
Copy link

@revskill10 revskill10 commented Jul 1, 2019

Why this issue closed ? It's not been solved yet.

@ai
Copy link
Member

@ai ai commented Jul 1, 2019

@revskill10 this issue is closed because I can’t do anything. Current Browserslist supports dead. You have the error because some of your libraries use very old Browserslist. You should call npm ls find who use old Browserslist and open issues in those tools.

@lovelstn
Copy link

@lovelstn lovelstn commented Jan 2, 2020

My solution:npm ls browserslist then update/remove any dependencies that list browserlists@<4.0.0

@kingemma
Copy link

@kingemma kingemma commented Apr 23, 2020

It was caused by in your local environment existed other Angular project that used latest version than your current project.
For me, I have Angular 8 and Angular 9 project. But my current project still used Angular 5 and cli is 1.7.4. When run npm install, and then run npm start or ng serve, it will popup error "Module build failed: BrowserslistError: Unknown browser query dead.

It can be fixed by add below config in your package.json. . You can get more detail in browserslist

,"browserslist": [ "defaults" ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet