From 675dec5ab3d0993e70c2e6d01d5501232d26bef4 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Mon, 3 Jan 2022 13:18:38 +0100 Subject: [PATCH] fix: Resolve `node_modules/` better (#706) * fix: Use `rootDir` instead of `projectDir` * Revert "fix: Use `rootDir` instead of `projectDir`" This reverts commit 058e0a110bcf9b688e12a1cccbac2f23a29fa55c. * fix: Find node_modules path where react-native/ lives * fix: Figure out VisionCameraExample project * Revert "fix: Figure out VisionCameraExample project" This reverts commit 7ca455098244dd62280d40586062803d1ccc2c5f. --- android/build.gradle | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 697feea..2f5f708 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,9 +7,10 @@ static def findNodeModules(baseDir) { // Node's module resolution algorithm searches up to the root directory, // after which the base path will be null while (basePath) { - def candidatePath = Paths.get(basePath.toString(), "node_modules") - if (candidatePath.toFile().exists()) { - return candidatePath.toString() + def nodeModulesPath = Paths.get(basePath.toString(), "node_modules") + def reactNativePath = Paths.get(nodeModulesPath.toString(), "react-native") + if (nodeModulesPath.toFile().exists() && reactNativePath.toFile().exists()) { + return nodeModulesPath.toString() } basePath = basePath.getParent() }