Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output: #1608

Closed
ckmonish2000 opened this issue May 13, 2022 · 14 comments
Labels
question Further information is requested

Comments

@ckmonish2000
Copy link

Ask your Question

Just created a new react-native project using npx react-native init, but after initializing the project running npx react-native run-android throws the 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.

while android folder is in the root dir.

I also Tried to sync the gradle files and it throws the following error =>

java.lang.Exception: React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output:

i've followed various approaches from setting up a react-native react-native.config file to deleting and reinstalling node modules nothing seems to work while i'm still able to run my old react-native project.

@ckmonish2000 ckmonish2000 added the question Further information is requested label May 13, 2022
@marqroldan

This comment was marked as outdated.

@marqroldan
Copy link

marqroldan commented May 13, 2022

Edit: I hid the comment above, but this issue only happens on Windows

This might be an issue with the glob package; I tried this sample code that looks for the AndroidManifest.xml

const glob = require('glob');
const path = require('path');
const fs = require('fs');

console.log(glob.sync(path.join('**', 'AndroidManifest.xml'), {
    cwd: 'android'
}))

With glob@7.2.0, it works, but with glob@7.2.2 it fails to return anything

image

7.2.2 was released 6 hours ago


Update:

Manually setting options.allowWindowsEscape to false seems to fix everything

I think it's not meant to be released in 7.2.2


Edit 3:

You can add another entry in the resolutions part of your package.json, so that it installs 7.2.0 instead of 7.2.2

  "resolutions": {
    "glob": "7.2.0"
  },

@ckmonish2000
Copy link
Author

Adding resolutions in package.json worked thanks a lot @marqroldan

@marqroldan
Copy link

@marqroldan where should i update the options

It's found in node_modules/glob/common.js around line 114

Also, @ckmonish2000, is it alright if you leave this issue open until the maintainers can take a look? Or until the glob author responds to my comment here isaacs/node-glob#468 (comment)

@ckmonish2000 ckmonish2000 reopened this May 14, 2022
@nicolas377
Copy link

nicolas377 commented May 14, 2022

With glob@7.2.0, it works, but with glob@7.2.2 it fails to return anything

@marqroldan could you try overriding glob to 7.2.1 and see if it works?

@marqroldan
Copy link

@nicolas377 Hello, 7.2.1 was never released, but setting the option allowWindowsEscape to false worked, so I was hoping that for 7.2 it would be false by default but true on 8.0

@nicolas377
Copy link

This has nothing to do with isaacs/node-glob#468, that's a feature targeting v8. This project uses v7, which means that this is affected by isaacs/node-glob#471. It will be fixed by the upstream PR tied to that issue. Hopefully, the v7 branch will have the fix by today.

@azhamdev
Copy link

thankss, solved for me

common.js and change options.allowWindowsEscape to false

@MarcosGoncalvesPires
Copy link

MarcosGoncalvesPires commented May 15, 2022

There is a solution on this video...
https://www.youtube.com/watch?v=AQqYPRHTTYI
after some days lookink for I found it and it solved the issue.

SOLUTION - nodeModules – Glob – common.js – options.allowWindowsScape = true….
change to “false”….

@francoders
Copy link

changing the 'options.allowWindowsEscape' to false works, I hope you fix the version soon. Thank you!

@nicolas377
Copy link

Please remember that modifying node_modules is always a bad plan! Your edits will be overwritten every time a reinstallation takes place, and your edits will not transfer to git. I have a PR up to fix the issue on glob (isaacs/node-glob#473). Until it gets merged, please override all glob dependencies to 7.2.0 by adding the following to package.json:

  "overrides": {
    "glob": "7.2.0"
  }

@nicolas377
Copy link

Glob 7.2.3 has been released, which has fixed this issue.

@isaacs
Copy link

isaacs commented May 15, 2022

Should be fixed by glob@7.2.3. If it isn't, please post a new issue at https://github.com/isaacs/node-glob/issues, ideally with a reproduction case. Thanks!

@nicolas377
Copy link

update the glob dependency to ^7.2.3 in your package.json, then run npm i

package.json

  "dependencies": {
-    "glob": "^7.2.0"
+    "glob": "^7.2.3"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants