Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npx create-react-app fails while executing yarnpkg on big sur

I've found a few posts on this already but none of the existing solutions seem to work.

  • OSX Big Sur
  • yarn 1.22.10
  • npm 7.0.11
  • I updated xcode developer tools.
  • I deleted npm cache
  • I removed .npm and .yarnrc folders

And then trying to start a new React app with npx create-react-app and getting the following:

error An unexpected error occurred: "expected workspace package to exist for \"eslint\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/gdboling/Projects/BalancedComp/clients/packages/rewards/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd /Users/gdboling/Projects/BalancedComp/clients/packages/rewards has failed.

The log file has:

26 verbose stack Error: command failed
26 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
26 verbose stack     at ChildProcess.emit (node:events:329:20)
26 verbose stack     at maybeClose (node:internal/child_process:1055:16)
26 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
like image 788
Gregg Avatar asked Nov 17 '20 16:11

Gregg


People also ask

Is it required to run NPX create react app my app every time when you need to create a react app?

If you are concerned with the size of it, you do not need to run create-react-app every time. You can make a react project yourself quite easily and by doing so you have much more control and understanding of your project.

What happens NPX create react app?

Create React App npx on the first line is not a typo — it's a package runner tool that comes with npm 5.2+. Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want.


1 Answers

Got the same problem on macOS Big Sur. I generally use brew to install my packages. Simply upgrading the packages solved it for me:

brew upgrade

and afterwards

brew cleanup

You may need to restart npm after brew finished upgrading.

like image 145
mhellmeier Avatar answered Sep 21 '22 07:09

mhellmeier