React Native Android 找不到项目

React Native Android Project Not Found

我遇到了这个错误。

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.

link没有解决方案。

  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.68.2"
  }
```
Package.json file

嗨,我已经用 3 个步骤解决了。

  1. 清除node_modules

  2. 将此添加到 package.json

    "resolutions": {
    "glob": "7.2.0" }
    
  3. 并使用 npm install

    重新安装

如果这不起作用,请使用 npm i glob@7.2.0

安装 glob

无需重新安装即可修复,只需进入node_modules文件夹,找到glob,然后打开common.js文件。 在第 114 行你会发现 options.allowWindowsEscape = true,把它改成 false 就可以完美运行了!