# All plugins undefined in ionic2

**URL:** <https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402>\
**Category:** ionic-v3\
**Created:** [March 3, 2016, 10:58am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402 "2016-03-03T10:58:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ondonda](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ondonda/32/98088_2.png) [@ondonda](https://forum.ionicframework.com/u/ondonda)\
**Post date:** [March 3, 2016, 10:58am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/1 "2016-03-03T10:58:24Z")

</div>

hi , i have installed some plugins in my fresh ionic2 app but none of them are working  
camera, toast, push result in error error cannot read property of undefined

this is what i’m doing for one of them (camera)

installation

**$ ionic plugin add cordova-plugin-camera**

code  
`getpic(){  
Camera.getPicture(onSuccess, onFail, {  
quality: 50, destinationType: Camera.DestinationType.FILE\_URI  
});  
function onSuccess(imageData){  
var image = document.getElementById(‘myImage’);  
image.src = imageURI  
}

function onFail(message){  
alert(“Failed because:” + message)

}  
}

`  
i also import Camera from ionic

this is what i get

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/1/2/12c2f9e1affcb70cfacc90b5fb39c812b857fcdd.png)

even if i use navigator.camera.getPicture it result the same , and for all plugins , they are undefined  
someone can help me with this?

---

<div class="post-metadata">

**Author:** ![joshmorony](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/joshmorony/32/117695_2.png) [@joshmorony](https://forum.ionicframework.com/u/joshmorony)\
**Post date:** [March 3, 2016, 11:19am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/2 "2016-03-03T11:19:41Z")

</div>

Are you trying to run this through the browser? Plugins only work when running on a device.

---

<div class="post-metadata">

**Author:** ![ondonda](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ondonda/32/98088_2.png) [@ondonda](https://forum.ionicframework.com/u/ondonda)\
**Post date:** [March 3, 2016, 11:24am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/3 "2016-03-03T11:24:27Z")

</div>

i’m running this on device too, none of them are working

---

<div class="post-metadata">

**Author:** ![richardshergold](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/richardshergold/32/91823_2.png) [@richardshergold](https://forum.ionicframework.com/u/richardshergold)\
**Post date:** [March 3, 2016, 11:29am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/4 "2016-03-03T11:29:13Z")

</div>

I don’t know if this will help your situation but I had a plug-in problem the other day which would only fix itself if I used the **cordova plugin** rather than the **ionic plugin** command. See [here](https://forum.ionicframework.com/t/adding-plug-ins-ionic-2/44776).

---

<div class="post-metadata">

**Author:** ![ondonda](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ondonda/32/98088_2.png) [@ondonda](https://forum.ionicframework.com/u/ondonda)\
**Post date:** [March 3, 2016, 11:39am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/5 "2016-03-03T11:39:43Z")

</div>

Yes , it works , many thanks

---

<div class="post-metadata">

**Author:** ![fredy26](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fredy26/32/92767_2.png) [@fredy26](https://forum.ionicframework.com/u/fredy26)\
**Post date:** [March 20, 2016, 5:53pm UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/6 "2016-03-20T17:53:06Z")

</div>

Doesn’t work for me… Trying to add toasts to my existing project.  
Trying to test on my Nexus 5 device using `ionic run android`, but I could see that `window.plugins` is `undefined` ☹  
Same plugin works fine if installed in fresh typescript project. I Just cant make it work on my existing ES6 project. Trying to remove using `ionic plugin remove cordova-plugin-x-toast` and then reinstall by `cordova plugin add cordova-plugin-x-toast` but no luck…  
**Maybe anyone knows the way to debug this?**  
BTW Using another plugin for scanning barcodes and it works just fine…

```
this.platform.ready().then(() => {
            //console.log(window.plugins);
           if (!!cordova) console.log('DEBUG || ' + JSON.stringify(cordova.plugins));
           if (!!window.plugins) console.log('DEBUG || ' + JSON.stringify(window.plugins));
            window.plugins.toast.show(message, "short", position);
        });
```

---

<div class="post-metadata">

**Author:** ![vcass](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@vcass](https://forum.ionicframework.com/u/vcass)\
**Post date:** [February 8, 2018, 7:10am UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/7 "2018-02-08T07:10:56Z")

</div>

![mobile](https://global.discourse-cdn.com/ionicframework/original/3X/8/d/8de703e11735e00e1a28f830f8ad86733a7b1362.png)

Same here, I do not understand, why window[‘plugins’].OrtcPushPlugin as undefined.

---

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [August 18, 2018, 2:45pm UTC](https://forum.ionicframework.com/t/all-plugins-undefined-in-ionic2/45402/8 "2018-08-18T14:45:34Z")

</div>

2018 and still the same problem
