Failed to install non-native cordova plugin in ionic v2

I am creating an Ionic 2 mobile app. I want to get the IP address of the network.

So, I want to install the plugin cordova-plugin-networkinterface

https://github.com/salbahra/cordova-plugin-networkinterface

      

Below is my ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.1.3
    @ionic/cli-plugin-cordova       : 1.1.2
    @ionic/cli-plugin-ionic-angular : 1.1.2
    Ionic Framework                 : ionic-angular 2.1.0

System:

    Node       : v6.10.2
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.1 Build version 8E1000a 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 4.5.0 

      

But, when I try to install the plugin using the command

ionic cordova plugin add cordova-plugin-networkinterface

      

I am getting the following 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 cordova-plugin-networkinterface --save (exit code 1):

        Installing "cordova-plugin-networkinterface" for android
        ANDROID_HOME=/Users/ankarthik/Library/Android/sdk
        JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
        Subproject Path: CordovaLib
        Failed to install 'cordova-plugin-networkinterface': Error: spawn EACCES
        at exports._errnoException (util.js:1018:11)
        at ChildProcess.spawn (internal/child_process.js:319:11)
        at Object.exports.spawn (child_process.js:378:9)
        at exports.spawn
        (/Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31)
        at /Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/lib/builders/GradleBuilder.js:261:16
        at _fulfilled
        (/Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/q/q.js:854:54)
        at self.promiseDispatch.done
        (/Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/q/q.js:883:30)
        at Promise.promise.promiseDispatch
        (/Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/q/q.js:816:13)
        at /Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/q/q.js:877:14
        at runSingle (/Users/ankarthik/Documents/projects/Juventus/platforms/android/cordova/node_modules/q/q.js:137:13)
        Error: spawn EACCES

      

Have already tried to resolve the permission issue mentioned below:

getting error: spawn EACCES while android build android in ubuntu 14.04

Also tried to downgrade my Ionic CLI to 2.1.0 but still the same error. Am I missing something here?

+3


source to share


1 answer


Delete the Android platform folder and add it again. It should fix your problem by not checking folder permissions.



+2


source







All Articles