Error with npm install @ionic/pro

I’m trying to set up Monitoring, so I tried to follow instructions on this page http://ionicframework.com/docs/pro/monitoring/

I have run
npm install @ionic/pro

and I added the right lines to by app.module.ts file.

When I ran npm install @ionic/pro, it gave this error message:

+-- UNMET PEER DEPENDENCY @ionic-native/core@3.12.1
`-- @ionic/pro@1.0.9

What’s that all about? And how can I fix it?

These are my dependencies, from package.json

    "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/calendar": "^4.3.1",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/in-app-browser": "^4.3.2",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "^2.0.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-add-swift-support": "^1.6.1",
        "cordova-plugin-calendar": "^4.6.0",
        "cordova-plugin-compat": "^1.0.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-ionic": "^2.0.1",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "cordova-sqlite-storage": "^2.0.4",
        "ionic-angular": "3.6.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "onesignal-cordova-plugin": "^2.2.1",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },

OK, I manually changed the package.json dependencies. I just changed some of the @ionic version numbers to be bigger. Now it reads this:

 "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/calendar": "^4.3.1",
        "@ionic-native/core": "4.3.2",
        "@ionic-native/in-app-browser": "^4.3.2",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic/storage": "^2.0.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-add-swift-support": "^1.6.1",
        "cordova-plugin-calendar": "^4.6.0",
        "cordova-plugin-compat": "^1.0.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-ionic": "^2.0.1",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "cordova-sqlite-storage": "^2.0.4",
        "ionic-angular": "3.6.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "onesignal-cordova-plugin": "^2.2.1",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },

Now when I ran npm install @ionic/pro it didn’t give me any errors.

But when I upload to Ionic’s server with git, the build still fails saying:

[19:57:05]  typescript: src/app/app.module.ts, line: 21 
            Cannot find module '@ionic/pro'. 

      L21:  import { Pro } from '@ionic/pro';

@ionic/pro should be listed as a dependency as well.

What is your ionic info?

If you are on a too old npm, you have to add --save to the npm install command for that to happen.

Hey! It worked! Thanks.

I added “–save” to the npm install command, and it added it to my list of dependencies in package.json.

I don’t know why they didn’t mention the “–save” part on that instruction page. That would have been awfully handy.

My ionic info is:


cli packages: (C:\Users\timk\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.2

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.3
    npm               : 3.10.10
    OS                : Windows 7

Misc:

    backend : pro

Nope, actually it looks like the latest package is broken or something. When throwing exceptions, I have set up the code as the directions indicate, so I have this:

const IonicPro = Pro.init('MY_APP_ID', {
  appVersion: "THE VERSION"
});

console.log('IonicPro is: ', IonicPro);

export class IonicMonitoringErrorHandler extends IonicErrorHandler {
  handleError(error: any): void {
    super.handleError(error);
    console.error(error);
    IonicPro.monitoring.handleNewError(error.originalError || error);
  }
}
  1. When throwing an exception, I get an error: “IonicPro.monitoring.handleNewError is not a function”
  2. So then I look at the output of that console log and indeed, the monitoring object no longer has any methods except for these:

image

Something broke?

Just an update on this - the pro package was changed so that these objects are not available until after the deviceready event; the reason is they now depend on cordova-plugin-ionic which naturally, as a cordova plugin, depends on the cordova lifecycle.

Waiting for platform.ready() before using them is sufficient. In the meantime, simply checking that Pro.monitoring exists before using it is fine. Any exceptions that occur before that is ready should be build-breaking changes, and so you should catch them before deploying a new production version of the app.

Hi i have an error when trying to use Ionic Pro :
Could not find a declaration file for module '@ionic/pro'. '(...)/node_modules/@ionic/pro/dist/ionic-pro.module.min.js' implicitly has an 'any' type.

Any idea ?
Thanks in advance

I’m starting a new app when I try to launch it using the “super” template:
ionic start MyIonicProject super
I’m getting the following error:

npm ERR! path C:\SourceCode\Ionic\starter\node_modules@ionic\pro\bin\pro-sync-sourcemaps.js
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\SourceCode\Ionic\starter\node_modules@ionic\pro\bin\pro-sync-sourcemaps.js’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I tried with npm i -f but there still a file missing. (npm version 5.5.1)

Thanks for your comments and help.

1 Like

I’m seeing this in my project as well.

npm ERR! path D:\froxii-v2\node_modules\@ionic\pro\bin\pro-sync-sourcemaps.js
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'D:\froxii-v2\node_modules\@ionic\pro\bin\pro-sync-sourcemaps.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Michael\AppData\Roaming\npm-cache\_logs\2017-11-14T04_19_43_241Z-debug.log
cli packages: (C:\Users\Michael\AppData\Roaming\nvm\v8.9.1\node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : android 6.2.3 ios 4.3.1
    Ionic Framework    : ionic-angular 3.4.2

System:

    Node : v8.9.1
    npm  : 5.5.1
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy

I encountered the same issue. Try to remove @ionic/pro (npm uninstall @ionic/pro) and then remove its dependency in package.json, then you can build again. I guess there is a temporary issue with the package.

Yes. I can create the projects without problems, it is just when I try to install Pro SDK.
Install the free Ionic Pro SDK and connect your app? (Y/n) --> Avoid to install this package.
npm i --save -E @ionic/pro --> neither works trying to install it manually.
npm i @ionic/pro