如何修复RN GoogleSignin模块链接。

时间:2018-11-07 17:45:36

标签: react-native

每次使用Yarn时,一切都会炸毁,这是react-native-community给出的说明。

我尝试只执行npm install --save,然后使用link命令,但到目前为止没有任何效果。

我在做什么错?以及我该如何解决。

onsole.error: "RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking."

6 个答案:

答案 0 :(得分:2)

对于IOS,请将其添加到Pod文件中,并在run-ios之前进行pod安装:

pod'RNGoogleSignin',:path =>'../ node_modules / @ react-native-community / google-signin'

在手动将本机反应从0.59.9升级到0.62.2时,我遇到了类似的问题。在更改Pod文件之前,我还卸载了react-native-google-signin并安装了@ react-native-community / google-signin。

答案 1 :(得分:1)

经过2天的修补,我放弃了对react googlesignin的响应。.我只是遵循了Firebase指南和EXPO指南,一切正常。

世博会Google登录名获得凭据 然后Firebase检查凭证并登录。

如果您正在执行Firebase googlelogin的操作,并且已经安装了Firebase,则可以执行操作

googleLogin = async () => {
      try {
        const result = await Expo.Google.logInAsync({
          androidClientId: "Your Client ID",
          //iosClientId: YOUR_CLIENT_ID_HERE,  <-- if you use iOS
          scopes: ["profile", "email"]

        })
        if (result.type === "success") {
          const credential = firebase.auth.GoogleAuthProvider.credential(result.idToken, result.accessToken);
             firebase.auth().signInAndRetrieveDataWithCredential(credential).then(function(result){
               console.log(result);
             });
     this.props.navigation.navigate('Where you want to go');
   } else {
     console.log("cancelled")
   }
      } catch (e) {
        console.log("error", e)
      }
  }

答案 2 :(得分:1)

我也遇到了同样的错误。我已经使用以下命令安装了react-native-google-signin:npm我react-native-google-signin

我尝试使用以下命令进行安装:yarn add react-native-google-signin

对我有用。

答案 3 :(得分:0)

只需安装pos即可解决此问题:

步骤1: 转到应用内的ios文件夹, 检查pod文件中必须包含一行

  pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin'

如果不满意,请运行命令:

  react-native link, 

以上行将会出现。

步骤2: 现在运行以下命令。

 pod install 

答案 4 :(得分:0)

对于Android,请尝试使用cd android && .gradlew clean清理项目 然后使用rm -rf node_modules/ yarn.lockPackage.json.lock清理节点模块文件夹(如果使用的是npm)。这可能无法解决软件包的问题,​​但对我有用。

答案 5 :(得分:0)

对我来说,此解决方案有效:

  • 只需验证@ react-native-community / google-signin是否在您的package.json中

    npm i @ react-native-community / google-signin

  • 转到您的Podfile并添加以下行:

    pod'RNGoogleSignin',:path =>“ ../ node_modules / @ react-native-community / google-signin”

这可能对您有用。