# Ionic 3: CameraPreview.startCamera returns plugin\_not\_installed

**URL:** <https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947>\
**Category:** ionic-v3\
**Created:** [April 9, 2017, 10:05pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947 "2017-04-09T22:05:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![avilao](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@avilao](https://forum.ionicframework.com/u/avilao)\
**Post date:** [April 9, 2017, 10:05pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/1 "2017-04-09T22:05:18Z")

</div>

When I invoke the startCamera the promise returns an error with the message “plugin\_not\_installed”.

I installed it using: $ ionic cordova:plugin add cordova-plugin-camera-preview

But i noticed that the docs for native only have “Camera” and not “CameraPreview”.

Any thoughts? Thank you very much.

```
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { UserProvider } from '../../providers/user-provider';
import { Diagnostic } from '@ionic-native/diagnostic';
import { CameraPreview, CameraPreviewOptions } from '@ionic-native/camera-preview';

@IonicPage()
@Component({
    selector: 'picture-preview',
    templateUrl: 'picture-preview.html',
    providers: [CameraPreview, Diagnostic]
})

export class PicturePreviewPage {

    constructor(public navCtrl: NavController,
        public navParams: NavParams,
        private toastCtrl: ToastController,
        private userService: UserProvider,
        private diagnostic: Diagnostic,
        private cameraPreview: CameraPreview) {

        this.checkPermissions();
    }

    checkPermissions() {
        this.diagnostic.isCameraAuthorized().then((authorized) => {
            if (authorized) {
                console.log('starting Camera');
                this.initializePreview();
            }
            else {
                this.diagnostic.requestCameraAuthorization().then((status) => {
                    if (status == this.diagnostic.permissionStatus.GRANTED)
                        this.initializePreview();
                    else {
                        // Permissions not granted
                        // Therefore, create and present toast
                        this.toastCtrl.create(
                            {
                                message: "Cannot access camera",
                                position: "bottom",
                                duration: 5000
                            }
                        ).present();
                    }
                });
            }
        });
    }

    initializePreview() {
        // Make the width and height of the preview equal 
        // to the width and height of the app's window
        var cameraPreviewOpts: CameraPreviewOptions = {
            x: 0,
            y: 0,
            width: window.screen.width,
            height: window.screen.height,
            camera: 'rear',
            tapPhoto: true,
            previewDrag: true,
            toBack: true,
            alpha: 1
        };

        var that = this;

        this.cameraPreview.startCamera(cameraPreviewOpts).then(function () {
            that.toastCtrl.create(
                {
                    message: "Starting Camera: OK",
                    position: "bottom",
                    duration: 5000
                }
            ).present();
        }, function (error) {
            console.log('error', error);
        });

        // More code goes here
    }

}
```

---

<div class="post-metadata">

**Author:** ![avilao](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@avilao](https://forum.ionicframework.com/u/avilao)\
**Post date:** [April 10, 2017, 9:34pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/2 "2017-04-10T21:34:56Z")

</div>

```
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.0
Ionic CLI Version: 3.0.0-beta.5
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.4
Xcode version: Not installed

```

Also tried the platform.ready() aproach, with no success.

---

<div class="post-metadata">

**Author:** ![Devolus](https://avatars.discourse-cdn.com/v4/letter/d/cab0a1/32.png) [@Devolus](https://forum.ionicframework.com/u/Devolus)\
**Post date:** [April 16, 2017, 4:34pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/3 "2017-04-16T16:34:17Z")

</div>

I got the same problem and I did this:  
ionic plugin rm --save cordova-plugin-camera-preview  
ionic plugin add --save [https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview)

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [April 16, 2017, 5:08pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/4 "2017-04-16T17:08:27Z")

</div>

There is a Ionic Native thingie for this plugin (in beta though) that might help:  
[https://ionicframework.com/docs/native/camera-preview/](https://ionicframework.com/docs/native/camera-preview/)

---

<div class="post-metadata">

**Author:** ![avilao](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@avilao](https://forum.ionicframework.com/u/avilao)\
**Post date:** [April 16, 2017, 5:38pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/5 "2017-04-16T17:38:27Z")

</div>

I updated the cli, did those steps and also:  
$ npm install --save @ionic-native/camera-preview

Got it to work after that.

---

<div class="post-metadata">

**Author:** ![RuanDev207195](https://avatars.discourse-cdn.com/v4/letter/r/6bbea6/32.png) [@RuanDev207195](https://forum.ionicframework.com/u/RuanDev207195)\
**Post date:** [May 30, 2018, 9:53pm UTC](https://forum.ionicframework.com/t/ionic-3-camerapreview-startcamera-returns-plugin-not-installed/85947/6 "2018-05-30T21:53:46Z")

</div>

I know this is a bit late, but I have tried all of the above but with no luck… ☹

I keep on getting “plugin\_not\_installed” error and this is really upsetting me since my app will be based around this.
