Skip to content

Fails to determine project configuration #854

@Glinkis

Description

@Glinkis

I'm trying to run react native in a monorepo, and if I run the project with the old 2.9 version, I can run in development mode, if I override the native_modules.gradle-file like this:

-    def command = "node ./node_modules/react-native/cli.js config"
+    def command = "../../node_modules/react-native/cli.js config"

As well as run react-native start in my mobile folder, and run-android in my root folder in a separate terminal window.

But then can't build for production, due to it not finding the node_modules/react-native/cli.js-file when I run with the --variant=release flag.

Now I've upgraded to version 3.0.1 of the @react-native-community/cli package, And added a configuration file in my root folder like so:

// react-native.config.js
module.exports = {
  project: {
    android: {
      sourceDir: './packages/mobile/android',
    },
    ios: {
      project: './packages/mobile/ios/mobile.xcodeproj',
    },
  },
}

Then I run yarn react-native run-android --root packages/mobile from root.
However, it keeps complaining about my configuration.

React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output: <config output>

If I run react-native config in my root directory, this is what I get:

{
  "root": "C:\\Users\\glink\\Documents\\projects\\my-project",
  "reactNativePath": "C:\\Users\\glink\\Documents\\projects\\my-project\\node_modules\\react-native",
  "dependencies": {},
  "commands": [<commands omittted for brevity>],
  "assets": [],
  "platforms": {
    "ios": {},
    "android": {}
  },
  "haste": {
    "providesModuleNodeModules": [
      "react-native"
    ],
    "platforms": [
      "ios",
      "android"
    ]
  },
  "project": {
    "ios": {
      "sourceDir": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\ios",
      "folder": "C:\\Users\\glink\\Documents\\projects\\my-project",
      "pbxprojPath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\ios\\mobile.xcodeproj\\project.pbxproj",
      "podfile": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\ios\\Podfile",
      "podspecPath": null,
      "projectPath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\ios\\mobile.xcodeproj",
      "projectName": "mobile.xcodeproj",
      "libraryFolder": "Libraries",
      "sharedLibraries": [],
      "plist": [],
      "scriptPhases": []
    },
    "android": {
      "sourceDir": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android",
      "isFlat": true,
      "folder": "C:\\Users\\glink\\Documents\\projects\\my-project",
      "stringsPath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android\\src\\main\\res\\values\\strings.xml",
      "manifestPath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android\\app\\src\\main\\AndroidManifest.xml",
      "buildGradlePath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android\\build.gradle",
      "settingsGradlePath": "C:\\Users\\glink\\Documents\\projects\\my-project\\android\\settings.gradle",
      "assetsPath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android\\src\\main\\assets",
      "mainFilePath": "C:\\Users\\glink\\Documents\\projects\\my-project\\packages\\mobile\\android\\src\\main\\java\\com\\mobile\\MainApplication.java",
      "packageName": "com.mobile"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions