Search code examples
androidreact-nativereact-native-cli

react-native android project not found error


I am trying to create a react-native project using react-native cli. Command I used to create project

  • npx react-native init test

After this if I try to run this app by

  • cd test & npx react-native run-android

But I get this error:

error Android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside 'android' folder), consider setting project.android.sourceDir option to point to a new location.

I have android, ios folder in root project and node version is 16.15.0

This is my project json:

{
  "name": "test",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.68.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.67.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}


Solution

  • The issue comes after [email protected] was released. Follow the following steps and recompile the project.

    1. Clear node_modules
    2. add this to package.json "resolutions": { "glob": "7.2.0" }
    3. Reinstall node_modules with npm install

    If this not work try this command

    " yarn add [email protected]"