无法读取react本机项目中未定义的属性(阅读“sync”)

7nbnzgx9  于 2023-10-22  发布在  React
关注(0)|答案(2)|浏览(156)

你好,我正在升级我的rn项目从0.59.9到0.61.5
我已经升级了package.json中的react-native和react包,但在尝试通过运行react-native run-android --variant=alphaRelease命令进行构建时发现了此错误

Cannot read properties of undefined (reading 'sync')
TypeError: Cannot read properties of undefined (reading 'sync')
    at findProject (/Users/widhi.nugraha/projects/kbru/v1/fo-apps-v1/node_modules/@react-native-community/cli-platform-ios/build/config/findProject.js:67:35)

如果我没记错的话,react-native插件告诉我取消所有项目中的包的链接。我这样做了,然后这个错误就发生了。
这是我的android/build.gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "29.0.1"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 30
        supportLibVersion = "28.0.0"
        kotlinVersion = "1.9.10"
        kotlin_version = "1.9.10" 
    }
    ext.kotlin_version = "1.9.1i0" 
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
        // maven {
        //     url "https://repo.spring.io/plugins-release/"
        // }
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        // classpath("com.android.tools.build:gradle:3.4.0")
        classpath('com.google.gms:google-services:4.3.8')
        // classpath('com.google.gms:google-services:4.2.0')
        // classpath 'com.google.firebase:firebase-plugins:1.1.1'
        classpath 'com.google.firebase:perf-plugin:1.1.5'
        // classpath 'io.fabric.tools:gradle:1.+'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        // ADD THIS
        // maven { url 'https://maven.google.com' }

        // ADD THIS
        maven { url "https://jitpack.io" }
        // maven {
        //     url "https://repo.spring.io/plugins-release"
        // }
        maven {
            url "https://maven.google.com"
        }
        mavenCentral()

        // Add the midtrans repository into the list of repositories
        // maven { url "http://dl.bintray.com/pt-midtrans/maven" }
    }
}
        
}
oxalkeyp

oxalkeyp1#

大多数情况下,当我们错误地导出模块时,此错误会出现在节点端项目中

要检查此错误,您可以检查位于此路径的文件:

(/Users/widhi.nugraha/projects/kbru/v1/fo-apps-v1/node_modules/@react-native-community/cli-platform-ios/build/config/findProject.js:67:35)

并检查导出的类型是否正确?

kqlmhetl

kqlmhetl2#

我只是通过在React Native Upgrade Helper的帮助下将react-native升级到0.62.2版本来解决这个错误

相关问题