I am trying to create a react-native project using react-native cli. Command I used to create project
After this if I try to run this app by
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 (eg 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" } }
I was facing the same issue too so i've created a thread on r/reactnative and someone kind provided a solution. Not sure why, but it works for me. The solution is:
https://www.reddit.com/r/reactnative/comments/uphynu/hello_there_is_a_new_error_i_guess/
The issue comes after glob@7.2.2 was released. Follow the following steps and recompile the project.
If this not work try this command
" yarn add glob@7.2.0"
Update on the tagged date. I had the same error on a new install. version 0.69.0 had problems finishing the install. Suggestion from github that I install new project with the previous version
npx react-native init ProjectName --version 0.68.2
I fixed mine by using cortinico's answer from https://github.com/facebook/react-native/issues/34055#issuecomment-1165887713
The issue is caused by having some globally installed Yarn/NPM packages which is not generally recommended.
Depending on the commands you installed in the past with -g, you should be able to cleanup your environment with a combination of those commands:
yarn global remove react-native
yarn global remove react-native-cli
npm uninstall -g react-native
npm uninstall -g react-native-cli
Make sure the global packages are clean with:
yarn global list
npm -g list
(check that nothing react-native related is available in those lists).
Afterwards you can then simply install using:
npx react-native init PROJECT_NAME
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.