升级到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
Run Code Online (Sandbox Code Playgroud)
nad*_*ani 12
我设法通过执行以下操作使错误消失:
// react-native.config.js
module.exports = {
dependencies: {
'<dependency>': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink
},
},
},
};
Run Code Online (Sandbox Code Playgroud)
基本上,自动链接是对本机链接的替代。如果您一直在使用0.60之前的React Native版本。
但是您也可以为不受支持的库禁用自动链接
在过渡期间,某些软件包可能不支持某些平台上的自动链接。要禁用软件包的自动链接,请更新您的react-native.config.js的依赖项条目,如下所示:
// react-native.config.js
module.exports = {
dependencies: {
'some-unsupported-package': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
},
},
};
Run Code Online (Sandbox Code Playgroud)
要进一步说明,请访问以下链接:https : //github.com/react-native-community/cli/blob/master/docs/autolinking.md
小智 6
我收到此错误“React Native CLI 使用自动链接本机依赖项,但以下模块是手动链接的”。然后我通过使用这三个命令从我的 IOS 项目中删除这三个依赖项,react-native-gesture-handler、react-native-reanimated 和 react-native-vector-icons 来解决错误;
react-native unlink react-native-gesture-handler --platforms ios
react-native unlink react-native-reanimated --platforms ios
react-native unlink react-native-vector-icons --platforms ios
Run Code Online (Sandbox Code Playgroud)
然后,$ cd ios然后ios/myproject$ pod install然后cd ..然后myproject$ npx react-native run-ios
| 归档时间: |
|
| 查看次数: |
12534 次 |
| 最近记录: |