错误 React Native CLI 对本机依赖项使用自动链接,但以下模块是手动链接的

2024-01-10

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

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

错误信息如下:

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

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

  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
      },
    },
  },
};

Source https://github.com/kmagiera/react-native-gesture-handler/issues/671#issuecomment-508903588

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

错误 React Native CLI 对本机依赖项使用自动链接,但以下模块是手动链接的 的相关文章

随机推荐