请澄清一下,我正在使用Android Studio运行Windows计算机。
我正在尝试在react本机应用程序中使用react-native-camera设置QR码扫描仪。
我可以毫无问题地安装该库:
$ npm install react-native-camera --save
给予
npm WARN babel-eslint@10.0.1 requires a peer of eslint@>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-eslint-comments@3.1.2 requires a peer of eslint@>=4.19.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-flowtype@2.50.3 requires a peer of eslint@>=2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jest@22.4.1 requires a peer of eslint@>=5 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-hooks@1.6.1 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename '[file location]\node_modules\.staging\fsevents-7a20bca6\node_modules\needle' -> '[file location]\node_modules\.staging\needle-41ea96cc'
+ react-native-camera@3.8.0
updated 1 package and audited 948127 packages in 76.202s
found 0 vulnerabilities
我见过的每个在线参考,例如https://facebook.github.io/react-native/docs/linking-libraries-ios 仅当您在Mac上为iOS编程时,才似乎给出说明。
位于https://react-native-community.github.io/react-native-camera/docs/installation的图书馆文档建议使用
自动链接 $ react-native link react-native-camera
。
我得到:
info Linking "react-native-camera" iOS dependency
info iOS module "react-native-camera" has been successfully linked
info Linking "react-native-camera" Android dependency
info Android module "react-native-camera" has been successfully linked
使用$ react-native run-android
在我的设备上将其构建时,会出现问题:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-camera (to unlink run: "react-native unlink react-native-camera")
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
手动链接的唯一结果是在XCode上,但是有人可以帮助我使用Android Studio吗?我真的很感激。
答案 0 :(得分:0)
您似乎正在使用新版本的react-native(0.60或更高版本)。在这种情况下,您不必自己链接库,因为支持最新react-native的库现在可以在安装时自行链接。
您应该能够执行npm install react-native-camera --save
并使其起作用。如果以前使用过react-native link react-native-camera
,现在可能需要运行react-native unlink react-native-camera
来还原链接命令所做的操作。您可能还需要重新安装该库(npm uninstall react-native-camera
后跟npm install react-native-camera --save
)。如果仍然无法正常工作,则可以通过manual installation of this library