作者:gpik40799 | 来源:互联网 | 2023-06-24 13:21
我是ReactNative的新手,所以我想打开一个Web视图,并使用以下命令安装WebView:
npm install --save react-native-webview
npx react-native link react-native-webview
现在,当我运行此代码时:
npx react-native run-android --deviceId 127.0.0.1:62001
返回此错误:
React本机CLI使用自动链接来处理本机依赖性,但是以下模块是手动链接的:
-react-native-webview(要取消链接运行:“ react-native unlink react-native-webview”)
将React Native从0.60以下升级到0.60或以上时,可能会发生这种情况。
"dependencies": {
"react": "16.9.0","react-native": "0.61.5","react-native-webview": "^8.0.1"
},"devDependencies": {
"@babel/core": "^7.6.2","@babel/runtime": "^7.6.2","@react-native-community/eslint-config": "^0.0.5","babel-jest": "^24.9.0","eslint": "^6.5.1","jest": "^24.9.0","metro-react-native-babel-preset": "^0.56.0","react-test-renderer": "16.9.0"
},
我该怎么办?
反应本机0.60及更高版本使用自动链接。这意味着您不需要手动链接。
现在您必须取消链接lib
npx react-native unlink react-native-webview
然后
npx react-native run-android