I can not add plugin ImagePicker

I want to add imagePicker plugin.
ionic cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --save
But i got an error.

✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.
        
[ERROR] An error occurred while running cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --sav... (exit code 1):
        
        Error: Failed to fetch plugin https://github.com/Telerik-Verified-Plugins/ImagePicker via registry.
        Probably this is either a connection problem, or plugin spec is incorrect.
        Check your connection and plugin name/version/URL.
        Error: npm: Command failed with exit code 235 Error output:
        npm ERR! addLocal Could not install /var/folders/d5/lftkh5rs3zn93sq_3vfk8c2w0000gp/T/npm-4427-a10ff8ca/git-cache-201971fb/1d453300ae3dacb007a404fd59536afcb67ab286
        npm ERR! code EISDIR
        npm ERR! errno -21
        npm ERR! syscall read
        npm ERR! eisdir EISDIR: illegal operation on a directory, read
        npm ERR! eisdir This is most likely not a problem with npm itself
        npm ERR! eisdir and is related to npm not being able to find a package.json in
        npm ERR! eisdir a package you are trying to install.
        
        npm ERR! A complete log of this run can be found in:
        npm ERR!     /Users/ThunderBirdsX3/.npm/_logs/2017-05-15T10_33_46_956Z-debug.log

It can use ionic cordova plugin add cordova-plugin-image-picker.
But when I use function hasReadPermission(). I got an error.

[17:15:47]  console.warn: Native: tried calling ImagePicker.hasReadPermission, but the ImagePicker plugin is not 
            installed. 
[17:15:47]  console.warn: Install the ImagePicker plugin: 'ionic plugin add 
            https://github.com/Telerik-Verified-Plugins/ImagePicker' 
[17:15:47]  console.error: error : plugin_not_installed
1 Like

You also need to add the npm package

npm install --save @ionic-native/image-picker

Since you upgraded to Cordova 7, all packages have to get a package.json.
You can fork his repo and add a package.json
That’s what I did: https://github.com/Keko94/ImagePicker

2 Likes

Assuming that you’re using Ionic v1.x and ngCordova, you need to use the following command

ionic plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker

or

cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker

Notice that I’m using ionic plugin add instead of ionic cordova plugin add.

Ionic v1.x CLI it’s a wrapper for Cordova CLI, so you don’t need to mix two commands as one.

FWIW, I found that ImagePicker plugin buggy as hell. If you can handle only choosing one image at a time, I have had much better results with the Camera plugin.

2 Likes

That command from ionic 3.2.0

I’m not sure of that…

But I’m sure about that. Because in APIs documents, They didn’t update command to lasted version.

Hey keko! I still getting the error, I’ve forked the repo https://github.com/victordeassis/ImagePicker and added the package.json, but when I run the command ionic cordova plugin add https://github.com/victordeassis/ImagePicker.git the error continues… can you help me please?

If you have teamviewer I can try to help you.
Show me your package.json please