首页 > 解决方案 > 为什么react native在取消链接后仍然认为我的库是链接的?(0.60.x)

问题描述

升级到 RN 0.60.x 时,我一直看到此错误消息:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-localize (to unlink run: "react-native unlink react-native-localize")
  - react-native-orientation-locker (to unlink run: "react-native unlink react-native-orientation-locker")
  - react-native-svg (to unlink run: "react-native unlink react-native-svg")

这仍然存在,包括在按照指示取消链接库、搜索所有项目文件以供参考以及使用yarn remove/之后yarn add

如何成功取消链接并摆脱此错误消息?

标签: react-native

解决方案


就我而言,Podfile 中有一些注释掉的 Pod 引用。

似乎 React Native 无法判断这些行已被注释掉:

#  pod 'RNSVG', :path => '../node_modules/react-native-svg'
#  pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
#  pod 'RNLocalize', :path => '../node_modules/react-native-localize'

修复只是完全删除这些行;那摆脱了错误。


推荐阅读