codeforsanjose / disaster-response-sj

Exploration of adding civic tech component to San Jose disaster response
MIT License
7 stars 12 forks source link

npm run build fails due to browserslist 'dead' being unknown query #79

Open sunnymui opened 5 years ago

sunnymui commented 5 years ago

Running npm run build to create a production build of the app fails with the following error message:

./src/compositions/FEMAChecklist/FEMAChecklist.css
Module build failed: BrowserslistError: Unknown browser query `dead`
    at Array.forEach (<anonymous>)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! disaster-relief@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the disaster-relief@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging outpu
t above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sunny\AppData\Roaming\npm-cache\_logs\2019-08-29T06_27_09_136Z-debug.log

It's likely due to some dependency or something that needs to be updated. More specifically, the issue is with the Browserlist config and some packages using old Browserlist versions, at least from my quick research: https://mixstersite.wordpress.com/2019/02/03/solved-module-build-failed-browserslisterror-unknown-browser-query-dead-react-npm/

Looks like the easiest solution is to create a separate .browserslistrc file cut/paste the browserslist config from package.json into the new .browserslistrc file.

Current browserslist config:

"browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ],

Other troubleshooting steps include doing an npm update and other stuff mentioned in the linked article.