Search code examples
reactjsyarnpkg

create-react-app not working after installing yarn and npx working


I am a new mac user I just have bought a mac m1 and I have a strange problem. i have yarn v3 installed when i try to run command

yarn create-react-app app 

it gives me this error

Usage Error: The project in /Users/home/package.json doesn't seem to have been installed - running an install there might help

Solution

  • 'create-react-app' is a toolkit to quickly create a React app with some boilerplate code.

    You can create a React app in 2 steps:

    Step 1: install create-react-app

    Step 2: use create-react-app to create your app.

    For step 1: To install create-react-app use the following command:

    yarn global add create-react-app
    

    For step 2: To use this to create your React app:

    create-react-app app
    

    You can also create the app without globally installing the 'create-react-app' package:

    npx create-react-app <app name>
    

    For your reference: https://reactjs.org/docs/create-a-new-react-app.html#create-react-app