error: plugin_not_installed on Ionic 3 Single Page app
See original GitHub issueI know this issue has been reported before, but none of the solutions posted there have worked for me, so I am creating a new issue. I will include my ionic environment info, package.json, and config.xml at the bottom of this.
I have added this Cordova plugin, and when I try to call CameraPreview.startCamera(), I get the error “plugin_not_installed”, with a warning message “Install the CameraPreview plugin: ‘ionic cordova plugin add cordova-plugin-camera-preview’”. I have run that command and it appears to be successfully added, but when I run ionic serve -c, and try loading the app on my iPhone (iPhone X, iOS 11.3), I continue to to get the same issue.
Here is my Ionic Environment Info:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Node : v9.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Here is the plugin in the config.xml
<plugin name="cordova-plugin-camera-preview" spec="git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git" />
Here is the package.json dependency
"cordova-plugin-camera-preview": "git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git",
Here is the home.ts where I am trying to initialize the CameraPreview
import { CameraPreview } from '@ionic-native/camera-preview';
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(private platform : Platform, public navCtrl: NavController, private cameraPreview: CameraPreview) {
this.platform.ready().then(()=> {
let options = {
x: 0,
y: 0,
width: window.screen.width,
height: window.screen.height,
tapPhoto: true,
previewDrag: true,
toBack: true,
}
this.cameraPreview.startCamera(options).then(
(res)=> {
console.log(res)
},
(err) => {
console.log(err)
});
})
}
ionViewDidLoad() {
console.log('ionViewDidLoad CameraPage');
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
i got same error , please help
@kurodenjiro I think your answer is similar to the solution I found. I had been trying to build on the Ionic DevApp. I used the “cordova platform add ios” to create the Xcode project, and when I ran the app through Xcode, it worked.
I am not 100% sure, but I read somewhere in my search for a solution that the Ionic DevApp builds and renders as a web view, and as seen on the plugin page, this plugin is only available for iOS and Android. So if you’re still facing this issue, I would recommend adding the platform of the device you’re using (iOS or Android), and opening it in Xcode/Android Studio and testing there. Hope this helps.