Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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>) 
like image 465
DGB Avatar asked Jun 18 '19 08:06

DGB


People also ask

Why react app is not creating?

If you really need create-react-app , you might need to reinstall Node and reconfigure your dependencies to ensure you have a fresh start with Node, npm, npx, and the like.

How do you fix you are running create react app 4.0 3 which is behind the latest release 5.0 0 We no longer support global installation of create react app?

To solve the React. js error "You are running create-react-app 4.0. 3, which is behind the latest release (5.0. 0)", run the npx clear-npx-cache command and re-run your app creation command, e.g. npx create-react-app my-app .

Which command is used to install create react app?

To install the full React toolchain on WSL, we recommend using create-react-app: Open a terminal(Windows Command Prompt or PowerShell). Create a new project folder: mkdir ReactProjects and enter that directory: cd ReactProjects . npx is the package runner used by npm to execute packages in place of a global install.

When to use create react app vs next?

Should I Use Next JS or CRA? Typically if you have an application that will only be used behind a login, CRA is a good choice. However, if you have an application for which SEO is important and fast page loads are critical, then Next JS is the right solution.


2 Answers

It is a new bug in BrowserList.

There are new reports on this both in create-react-app: https://github.com/facebook/create-react-app/issues/7239

and in browserlist: https://github.com/browserslist/browserslist/issues/382#issuecomment-502991170

As suggested by John Forbes below the workaround given on the github issue is to change the browserslist entry in package.json to

"browserslist": [] 

This will build and run the project.

like image 98
Orhan Avatar answered Sep 18 '22 07:09

Orhan


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

  "resolutions": {     "browserslist": "4.6.2",     "caniuse-lite": "1.0.30000974"   }, 
like image 33
AxaZol Avatar answered Sep 19 '22 07:09

AxaZol