Search code examples
jsonreactjsnpmyarnpkg

yarn start - command "start" not found


yarn start leads to an error saying command "start" not found. In my package.json file there is no script's tag, could that be the issue. Please suggest a fix.

I am trying to install react, the commands being:

npm install -g create-react-app@1.5.2
create-react-app confusion
yarn start

cmd error: command prompt

package.json:

  "name": "confusion",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  }
}

Solution

    1. npm uninstall -g create-react-app // uninstall the old create-react-app version (in your case, v1.5.2) to make sure npx uses the latest version in Step 2
    2. npx create-react-app my-react-app-name // npx installs the latest version of create-react-app without requiring a global install. it is included with npm, so no need to install it. if you wish, replace my-react-app-name with whatever you want your project to be called
    3. cd my-react-app-name
    4. yarn start