我正在尝试使用条形码阅读器,因为我真的需要它用于我的应用程序,但我无法启动任何我找到的项目 .
例如,https://github.com/ideacreation/react-native-barcodescanner . 我应该使用哪个命令来启动它?
$ cd /c/Users/Me/Desktop/react-native-barcodescanner-master
$ npm i
$ npm i --save react-native-barcodescanner
npm ERR! Windows_NT6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Me\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "react-native-barcodescanner"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! code ENOSELF
npm ERR! Refusing to install react-native-barcodescanner as a dependency of itself
$ npm start npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Me\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.3 npm ERR! npm v3.10.10
npm ERR! missing script: start
1 回答
使用react-native v0.44不推荐使用此库,您应该使用react-native-camera .
您使用的命令
npm i --save react-native-barcodescanner
用于将此lib安装到您的项目中 .如果您仍想使用此lib,请按照this instruction:
进口:
然后在你的组件中使用: