错误 React Native CLI 对原生依赖使用自动链接,但以下模块是手动链接的 [英] error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually

查看:275
本文介绍了错误 React Native CLI 对原生依赖使用自动链接,但以下模块是手动链接的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 React Native 0.60 后出现此错误.

This error came up after upgrading to React Native 0.60.

我已尝试按照错误消息中的建议使用 react-native unlink 手动取消链接每个手动链接的依赖项,但问题仍然存在.

I've tried to manually unlink each manually linked dependency using react-native unlink <dependency> as suggested in the error message, but the problem still persists.

错误信息如下:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-admob (to unlink run: "react-native unlink react-native-admob")
  - react-native-facebook-account-kit (to unlink run: "react-native unlink react-native-facebook-account-kit")
  - react-native-fbsdk (to unlink run: "react-native unlink react-native-fbsdk")
  - react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
  - react-native-linear-gradient (to unlink run: "react-native unlink react-native-linear-gradient")
  - react-native-localization (to unlink run: "react-native unlink react-native-localization")
  - react-native-restart (to unlink run: "react-native unlink react-native-restart")
  - react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
  - react-native-webview (to unlink run: "react-native unlink react-native-webview")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

推荐答案

我通过执行以下操作设法使错误消失:

I managed to make the error go away by doing as follows:

  1. 在项目的根目录中创建一个 react-native.config.js 文件.
  2. 将其更新为如下所示:

// react-native.config.js
module.exports = {
  dependencies: {
    '<dependency>': {
      platforms: {
        android: null, // disable Android platform, other platforms will still autolink
      },
    },
  },
};

来源

这篇关于错误 React Native CLI 对原生依赖使用自动链接,但以下模块是手动链接的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆