When I was trying to create React Native project using react-native cli. I was getting below 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. info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command I was using
npx react-native init test
After running the command npx react-native init test , I was trying to run my android app by using below command
cd test & npx react-native run-android
Then I got below 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.
If you are also facing same type of error then no worries , we will provide fix for this.
Why Android Project Not Found Error Occurred in React Native?
Android project not found error occurred in React Native when glob@7.2.2 version was released
How to fix Android Project Not Found Issue in React Native?
Fix 1: Using Reinstall node_module
To fix the Android Project Not Found Issue in React Native, first you have to delete node_modules
then add "resolutions": { "glob": "7.2.0" }
to package.json file . Finally Reinstall the node_modules
with npm install.
Steps to Fix Android Project Not Found Issue in React Native:
Step 1: Delete node_module
Step 2: Add below to package.json file:
"resolutions": { "glob": "7.2.0" }
Step 3: Again reinstall node_module
with npm install
Fix 2: Using glob
If above fix not work then install the glob with npm i glob@7.2.0
.
Fix 3: Without Reinstalling node_module
If you want to fix Android Project Not Found Issue in React Native without re installing node_module
then go into the node_modules
folder, find glob
, and open the common.js
file.
After that in line 114 you will find options.allowWindowsEscape = true
, change it to
and it will work perfectly!options.allowWindowsEscape = false
Steps to fix Android Project Not Found Issue in React Native without re installing node_module :
- Go to
node_modules
folder - After going to
node_modules
folder, findglob
- In
glob
, opencommon.js
file - After opening
common.js
file, go to line number 114 - In line number 114, you will find
options.allowWindowsEscape = true
- Now replace
options.allowWindowsEscape = true
tooptions.allowWindowsEscape = false
- Your issue will be resolved.
Conclusion
Android project not found error occurred in React Native when glob@7.2.2 version was released.
There are 3 possible fixes for this isuue, with reinstalling node_module
, using glob or without reinstalling node_module
.
Hope one of above 3 fixes resolved your issue.
Read More:
Steam Summer Sale is Live now! To Check the Steam Summer Sale Clues Answers, Click Below:
- Steam Summer Sale Clue 1 Answer
- Steam Summer Sale Clue 2 Answer
- Steam Summer Sale Clue 3 Answer
- Steam Summer Sale Clue 4 Answer
- Steam Summer Sale Clue 5 Answer
- Steam Summer Sale Clue 6 Answer
- Steam Summer Sale Clue 7 Answer
- Steam Summer Sale Clue 8 Answer
- Steam Summer Sale Clue 9 Answer
- Steam Summer Sale Clue 10 Answer