0

I'm trying to use a barcode reader, because I really need it for my app, but I'm unable to start any projects that I've found.

For example, https://github.com/ideacreation/react-native-barcodescanner. Which command should I use to start this?

$ 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
Rich Churcher
  • 7,361
  • 3
  • 37
  • 60
NormalArs
  • 101
  • 2
  • 11
  • Is it your first time to use node / npm codes? If so, you should learn about node project. If not, please post your package.json. – Toris Dec 09 '17 at 06:29
  • You can able to identify what went wrong in the file npm-debug.log it will be located C:\Users\Me\Desktop\react-native-barcodescanner-master\npm-debug.log READ it – Gopinath Kaliappan Dec 09 '17 at 06:42
  • Related link for learning node.js [How do I get started with Node.js](https://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js) – Toris Dec 09 '17 at 06:49

1 Answers1

2

This library is deprecated with react-native v0.44, you should use react-native-camera.

The command you used npm i --save react-native-barcodescanner is for install this lib to your project.

If you still want to use this lib, follow this instruction:

Import:

import BarcodeScanner from 'react-native-barcodescanner';

Then use in your Component:

render() {
    return (
      <BarcodeScanner
        onBarCodeRead={this.barcodeReceived}
        style={{ flex: 1 }}
        torchMode={this.state.torchMode}
        cameraType={this.state.cameraType}
      />
    );
  }
nhoxbypass
  • 9,695
  • 11
  • 48
  • 71