Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Camera Plugin not working (build error)

$
0
0

@melbrinek wrote:

Hi guys,

According to the documentation here: http://ionicframework.com/docs/v2/native/Camera/
I was unable to make plugins work correctly. I tried to test Camera and Barcode Scanner and in both cases I encounter similar problem.
Error message:

./plugins/cordova-plugin-camera/www/Camera.js
Module not found: Error: Cannot resolve module 'cordova/argscheck' in /Users/yhnavein/puredev/test/test-app/plugins/cordova-plugin-camera/www
resolve module cordova/argscheck in /Users/yhnavein/puredev/test/test-app/plugins/cordova-plugin-camera/www
  looking for modules in app
    app/cordova doesn't exist (module as directory)
  looking for modules in /Users/yhnavein/puredev/test/test-app/node_modules
    /Users/yhnavein/puredev/test/test-app/node_modules/cordova doesn't exist (module as directory)
[app/cordova]
[/Users/yhnavein/puredev/test/test-app/node_modules/cordova]
 @ ./plugins/cordova-plugin-camera/www/Camera.js 22:16-44,./plugins/cordova-plugin-camera/www/Camera.js
Module not found: Error: Cannot resolve module 'cordova/exec' in /Users/yhnavein/puredev/test/test-app/plugins/cordova-plugin-camera/www
resolve module cordova/exec in /Users/yhnavein/puredev/test/test-app/plugins/cordova-plugin-camera/www
... etc ...

Probably I don't have something installed / configured, but I have no knowledge about additional stuff to do, as I just wanted to try out the native functions in Ionic 2.

Plugin added by: ionic plugin add cordova-plugin-camera
My JS code:

import {Camera} from '../../../plugins/cordova-plugin-camera/www/Camera';
//...
export class HelloIonicPage {
	scanCode(event) {
		Camera.getPicture(options).then((imageData) => {
		  // imageData is either a base64 encoded string or a file URI
		  // If it's base64:
		  let base64Image = "data:image/jpeg;base64," + imageData;
		  console.log('Success');
		}, (err) => {
			console.error(err);
		});
	}
}

And ionic info:

Cordova CLI: 6.0.0
Gulp version:  CLI version 1.2.1
Gulp local:
Ionic Version: 2.0.0-beta.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v5.7.0
Xcode version: Not installed

What should I do to make it working?

Thanks,

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles