"npm ERR! peerinvalid" When adding android platform

Hi,

When I run

ionic cordova platform add android

I get the following output:

$ ionic cordova platform add android
> cordova platform add android --save
Using cordova-fetch for cordova-android@~6.3.0

Error: Failed to fetch platform cordova-android@~6.3.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Linux 3.13.0-77-generic
npm ERR! argv "/home/pisaris/.nvm/versions/node/v6.11.4/bin/node" "/home/pisaris/projects/batler.io_new/batler.io/node_modules/.bin/npm" "install" "cordova-android@~6.3.0" "--production" "--save-exact"
npm ERR! node v6.11.4
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @ionic-native/core@3.14.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/app-rate@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/camera@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/device@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file-path@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/in-app-browser@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/keyboard@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/local-notifications@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/native-page-transitions@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/native-storage@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/network@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/onesignal@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/screen-orientation@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/social-sharing@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.7.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.7.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/toast@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0

However, my package.json is as following:

{
  "name": "io.batler.sgl",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.0",
    "@angular/compiler": "4.1.0",
    "@angular/compiler-cli": "4.1.0",
    "@angular/core": "4.1.0",
    "@angular/forms": "4.1.0",
    "@angular/http": "4.1.0",
    "@angular/platform-browser": "4.1.0",
    "@angular/platform-browser-dynamic": "4.1.0",
    "@ionic-native/app-rate": "3.14.0",
    "@ionic-native/camera": "3.14.0",
    "@ionic-native/core": "3.14.0",
    "@ionic-native/device": "3.14.0",
    "@ionic-native/file": "3.14.0",
    "@ionic-native/file-path": "3.14.0",
    "@ionic-native/in-app-browser": "3.14.0",
    "@ionic-native/keyboard": "3.14.0",
    "@ionic-native/local-notifications": "3.14.0",
    "@ionic-native/native-page-transitions": "4.4.2",
    "@ionic-native/native-storage": "3.14.0",
    "@ionic-native/network": "3.14.0",
    "@ionic-native/onesignal": "3.14.0",
    "@ionic-native/screen-orientation": "3.14.0",
    "@ionic-native/social-sharing": "3.14.0",
    "@ionic-native/splash-screen": "3.7.0",
    "@ionic-native/status-bar": "3.7.0",
    "@ionic-native/toast": "^3.10.3",
    "@ionic-native/transfer": "^3.6.1",
    "@ionic/app-scripts": "3.0.1",
    "@ionic/storage": "2.0.1",
    "com.telerik.plugins.nativepagetransitions": "^0.6.5",
    "com.unarin.cordova.beacon": "^3.5.2",
    "cordova-ios": "~4.5.3",
    "cordova-plugin-app-event": "^1.2.1",
    "cordova-plugin-apprate": "^1.3.0",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-crosswalk-webview": "^2.3.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-dialogs": "^1.3.4",
    "cordova-plugin-email": "^1.2.6",
    "cordova-plugin-email-composer": "^0.8.11",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-filepath": "^1.1.0",
    "cordova-plugin-globalization": "^1.0.8",
    "cordova-plugin-inappbrowser": "^1.7.2",
    "cordova-plugin-nativestorage": "^2.2.2",
    "cordova-plugin-network-information": "^1.3.4",
    "cordova-plugin-screen-orientation": "^2.0.2",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.3.0",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.2.1",
    "cordova-plugin-x-toast": "^2.6.0",
    "cordova-sqlite-storage": "^2.1.2",
    "cordova-uglify": "^0.2.9",
    "de.appplant.cordova.plugin.local-notification": "^0.8.5",
    "es6-promise-plugin": "^4.1.1",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "ionic": "^3.4.0",
    "ionic-angular": "3.2.1",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "localforage": "^1.5.0",
    "localforage-cordovasqlitedriver": "^1.6.0",
    "onesignal-cordova-plugin": "^2.2.2",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.1.1",
    "setimmediate": "^1.0.5",
    "sw-toolbox": "3.6.0",
    "uglify-js": "^3.1.3",
    "web-animations-js": "^2.2.5",
    "woocommerce-api": "^1.4.2",
    "wpapi": "^1.1.2",
    "zone.js": "0.8.10"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.0",
    "@types/hammerjs": "^2.0.35",
    "crypto-js": "^3.1.9-1",
    "ionic": "3.18.0",
    "typescript": "^2.3.4"
  },
  "description": "batler.io: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordova": {
    "plugins": {
      "com.unarin.cordova.beacon": {},
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": " ",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": " "
      },
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-nativestorage": {},
      "cordova-sqlite-storage": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-crosswalk-webview": {
        "XWALK_VERSION": "23+",
        "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
        "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
        "XWALK_MODE": "embedded",
        "XWALK_MULTIPLEAPK": "true"
      },
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-x-socialsharing": {},
      "de.appplant.cordova.plugin.local-notification": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-email": {},
      "cordova-plugin-device": {},
      "cordova-plugin-apprate": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-email-composer": {},
      "cordova-plugin-file": {},
      "com.telerik.plugins.nativepagetransitions": {}
    },
    "platforms": [
      "ios"
    ]
  }
}

ionic info:

$ ionic info

cli packages: (/home/pisaris/projects/batler.io_new/batler.io/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.2.1

System:

    Android SDK Tools : 26.1.1
    Node              : v6.11.4
    npm               : 2.15.12 
    OS                : Linux 3.13

Environment Variables:

    ANDROID_HOME : /home/pisaris/Android/Sdk

Misc:

    backend : legacy

Also, when I run

npm outdated

I get the following output:

Package                            Current  Wanted  Latest  Location
@ionic/app-scripts                   3.0.1   3.0.1   3.1.2  io.batler.sgl
@angular/common                      4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/compiler                    4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/compiler-cli                4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/core                        4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/forms                       4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/http                        4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/platform-browser            4.1.0   4.1.0   5.0.3  io.batler.sgl
@angular/platform-browser-dynamic    4.1.0   4.1.0   5.0.3  io.batler.sgl
@ionic-native/app-rate              3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/camera                3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/core                  3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/device                3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/file                  3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/file-path             3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/in-app-browser        3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/keyboard              3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/local-notifications   3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/native-storage        3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/network               3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/onesignal             3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/screen-orientation    3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/social-sharing        3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic-native/splash-screen          3.7.0   3.7.0   4.4.2  io.batler.sgl
@ionic-native/status-bar             3.7.0   3.7.0   4.4.2  io.batler.sgl
@ionic-native/toast                 3.14.0  3.14.0   4.4.2  io.batler.sgl
@ionic/app-scripts                   3.0.1   3.0.1   3.1.2  io.batler.sgl
@ionic/storage                       2.0.1   2.0.1   2.1.3  io.batler.sgl
cordova-plugin-camera                2.4.1   2.4.1   3.0.0  io.batler.sgl
cordova-uglify                       0.2.9   0.2.9   0.3.0  io.batler.sgl
ionic-angular                        3.2.1   3.2.1   3.9.2  io.batler.sgl
rxjs                                 5.1.1   5.1.1   5.5.2  io.batler.sgl
zone.js                             0.8.10  0.8.10  0.8.18  io.batler.sgl

Any ideas about what is going on?
Thanks in advance :slight_smile:

This npm version looks a “bit” old. I would try upgrading to a more recent one, probably also to LTS of node.

@Sujan12 thanks for your answer.
I installed node v8.9.1 LTS via nvm (node version manager).

However, even though I get the correct version on npm (5.5.1) when I run npm -v:

$ npm -v
5.5.1

When I run ionic info, I get the “old” npm version:

$ ionic info

cli packages: (/home/pisaris/projects/batler.io_new/batler.io/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.2.1

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.1
    npm               : 2.15.12 
    OS                : Linux 3.13

Environment Variables:

    ANDROID_HOME : /home/pisaris/Android/Sdk

Misc:

    backend : legacy

Also, the problem I described in my posted question persists:

$ ionic cordova platform add android
> cordova platform add android --save
Using cordova-fetch for cordova-android@~6.3.0

Error: Failed to fetch platform cordova-android@~6.3.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Linux 3.13.0-77-generic
npm ERR! argv "/home/pisaris/.nvm/versions/node/v8.9.1/bin/node" "/home/pisaris/projects/batler.io_new/batler.io/node_modules/.bin/npm" "install" "cordova-android@~6.3.0" "--production" "--save-exact"
npm ERR! node v8.9.1
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @ionic-native/core@3.14.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/app-rate@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/camera@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/device@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file-path@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/in-app-browser@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/keyboard@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/local-notifications@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/native-page-transitions@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/native-storage@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/network@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/onesignal@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/screen-orientation@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/social-sharing@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.7.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.7.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/toast@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pisaris/projects/batler.io_new/batler.io/npm-debug.log

Have you tried reinstalling the node_modules?

@MattE, yes, I tried that multiple times.

Something is broken on your machine or in your project.

What does npm list --depth=0 return when you run it in the project?
What does npm return when you run it in the project?

$ npm

Usage: npm <command>

where <command> is one of:
    access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
    explore, get, help, help-search, i, init, install,
    install-test, it, link, list, ln, login, logout, ls,
    outdated, owner, pack, ping, prefix, profile, prune,
    publish, rb, rebuild, repo, restart, root, run, run-script,
    s, se, search, set, shrinkwrap, star, stars, start, stop, t,
    team, test, token, tst, un, uninstall, unpublish, unstar,
    up, update, v, version, view, whoami

npm <command> -h     quick help on <command>
npm -l           display full usage info
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /home/pisaris/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@5.5.1 /home/pisaris/.nvm/versions/node/v8.9.1/lib/node_modules/npm

And:

$ npm list --depth=0
io.batler.sgl@0.0.1 /home/pisaris/projects/batler.io_new/batler.io
├── @angular/common@4.1.0
├── @angular/compiler@4.1.0
├── @angular/compiler-cli@4.1.0
├── @angular/core@4.1.0
├── @angular/forms@4.1.0
├── @angular/http@4.1.0
├── @angular/platform-browser@4.1.0
├── @angular/platform-browser-dynamic@4.1.0
├── @ionic-native/app-rate@3.14.0
├── @ionic-native/camera@3.14.0
├── @ionic-native/core@3.14.0
├── @ionic-native/device@3.14.0
├── @ionic-native/file@3.14.0
├── @ionic-native/file-path@3.14.0
├── @ionic-native/in-app-browser@3.14.0
├── @ionic-native/keyboard@3.14.0
├── @ionic-native/local-notifications@3.14.0
├── @ionic-native/native-page-transitions@3.14.0
├── @ionic-native/native-storage@3.14.0
├── @ionic-native/network@3.14.0
├── @ionic-native/onesignal@3.14.0
├── @ionic-native/screen-orientation@3.14.0
├── @ionic-native/social-sharing@3.14.0
├── @ionic-native/splash-screen@3.7.0
├── @ionic-native/status-bar@3.7.0
├── @ionic-native/toast@3.14.0
├── @ionic-native/transfer@3.14.0
├── @ionic/app-scripts@3.0.1 invalid
├── @ionic/storage@2.0.1
├── @types/hammerjs@2.0.35
├── com.telerik.plugins.nativepagetransitions@0.6.5
├── com.unarin.cordova.beacon@3.5.2
├── cordova-android@6.3.0
├── cordova-ios@4.5.4
├── cordova-plugin-app-event@1.2.1
├── cordova-plugin-apprate@1.3.0
├── cordova-plugin-camera@2.4.1
├── cordova-plugin-compat@1.2.0
├── cordova-plugin-crosswalk-webview@2.3.0
├── cordova-plugin-device@1.1.7
├── cordova-plugin-dialogs@1.3.4
├── cordova-plugin-email@1.2.6
├── cordova-plugin-email-composer@0.8.11
├── cordova-plugin-file@5.0.0
├── cordova-plugin-file-transfer@1.7.0
├── cordova-plugin-filepath@1.1.0
├── cordova-plugin-globalization@1.0.8
├── cordova-plugin-inappbrowser@1.7.2
├── cordova-plugin-nativestorage@2.2.2
├── cordova-plugin-network-information@1.3.4
├── cordova-plugin-screen-orientation@2.0.2
├── cordova-plugin-splashscreen@4.1.0
├── cordova-plugin-statusbar@2.3.0
├── cordova-plugin-whitelist@1.3.3
├── cordova-plugin-x-socialsharing@5.2.1
├── cordova-plugin-x-toast@2.6.0
├── cordova-sqlite-storage@2.1.2
├── cordova-uglify@0.2.9
├── crypto-js@3.1.9-1
├── de.appplant.cordova.plugin.local-notification@0.8.5
├── es6-promise-plugin@4.1.1
├── hammerjs@2.0.8
├── intl@1.2.5
├── ionic@3.19.0 invalid
├── ionic-angular@3.2.1
├── ionic-plugin-keyboard@2.2.1
├── ionicons@3.0.0
├── localforage@1.5.3
├── localforage-cordovasqlitedriver@1.6.0
├── onesignal-cordova-plugin@2.2.2
├── reflect-metadata@0.1.10
├── rxjs@5.1.1
├── setimmediate@1.0.5
├── sw-toolbox@3.6.0
├── typescript@2.2.1
├── uglify-js@3.2.0
├── web-animations-js@2.3.1
├── woocommerce-api@1.4.2
├── wpapi@1.1.2
└── zone.js@0.8.10

npm ERR! invalid: @ionic/app-scripts@3.0.1 /home/pisaris/projects/batler.io_new/batler.io/node_modules/@ionic/app-scripts
npm ERR! missing: typescript@^2.3.3, required by @angular-devkit/build-optimizer@0.0.21
npm ERR! invalid: ionic@3.19.0 /home/pisaris/projects/batler.io_new/batler.io/node_modules/ionic

@Sujan12 how would you advise me to “reset” (even remove and re-install) everything related to npm so that I can fix whatever is “broken”? (Note that I currently use node version manager to operate npm).

I am pretty much out of ideas. npm returns the correct version and path, but ionic info return a different version.

One idea would be to switch to a different node version (or reinstall the current one) and see if the error persists there. Should not as nvm has dependencies for each node installation.

@Sujan12 It seems that npm is only wrong for this particular project…
I created a new test ionic project, ran ionic info and got npm : 5.5.1.
But when I run ionic info in this project, I get npm: 2.15.12
Is there a possibility that npm is locally installed in this project, so it overrides the globally installed one?

Edit: As I can see now, there is a node_modules/npm/bin/npm executable that does not exist in the “correct” project… So I am assuming that one of the dependencies of this project installs the 2.15.12 version of npm…

Yup, but that’s why I asked you to do npm list --depth=0 and that didn’t include npm. Maybe deeper? Run npm list and look for npm in there.

That would confirm it. Still it should not be used globally or at all tbh. Cordova itself uses npm 2.x as a dependency, but normally doesn’t use it unless you call a very specific way.

@Sujan12 I investigated the problem a bit more, and found that cordova-lib dependency (which is a dependency of cordova which is a dependency of cordova-plugin-apprate as I can see from running npm list), has a dependency on npm@^2.10.x

However, I cannot understand whether that is a bug or not (I am not very experienced in npm). Is it a good practice for a library to be dependent on npm itself?

It’s totally ok, npm is just a library. (Although this is getting removed in future Cordova versoins).

Question is why you system is using this npm to run on the global scope in this project :confused:

Hey,

just wanted to give an update on this issue, since I ran into the same one…

ionic cordova plugin add cordova-plugin-statusbar
> cordova plugin add cordova-plugin-statusbar --save
Error: Failed to fetch plugin cordova-plugin-statusbar@2.4.1 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 1 Error output:
npm ERR! Linux 4.13.0-32-generic
npm ERR! argv ".../.nvm/versions/node/v8.9.3/bin/node" ".../node_modules/.bin/npm" "install" "cordova-plugin-statusbar@2.4.1" "--production" "--save"
npm ERR! node v8.9.3
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm list gave me this error:

npm ERR! peer dep missing: @angular/core@5.2.3, required by @angular/animations@5.2.3

In my case I needed to update all angular-related components like this (stackoverflow):

npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest --save

After this npm list and ionic cordova plugin add cordova-plugin-statusbar worked as expected and the error messages were gone…

Maybe it helps someone!