create-react-app "Failed to compile" on start up

Viewed 12431

I am getting the following error when using npm start to open create-react-app. I'm new to React and I have had no problems the past few days doing the command line to make a new app.

I have tried npx start, npm start and installed npm again for the updated version.

Failed to compile
./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
BrowserslistError: Unknown browser query `android all`. Maybe you are using old Browserslist or made typo in query.
    at Array.reduce (<anonymous>)
    at Array.some (<anonymous>)
    at Array.filter (<anonymous>)
5 Answers

As proper temporal solution till bug fixing: add to package.json this:

  "resolutions": {
    "browserslist": "4.6.2",
    "caniuse-lite": "1.0.30000974"
  },

At the moment you can try this and wait for further fix

"browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [  
    ]
  }

I can confirm that forcing a yarn resolution for caniuse-lite@1.0.30000974 fixes the error. It must be an issue with the latest caniuse-lite@1.0.30000975 release.

temporary solution:

In package.json add

"resolutions": { "browserslist": "4.6.2", "caniuse-lite": "1.0.30000974" },

This method solved my problem.

I tried updating the browserlist and then did this.

  1. Delete this part in package.json
    "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
  1. And run npm start

  2. It will ask for yes or no, give yes

Solved!

Related