Using AppVersion with React

I’m trying to get the version of my app.

There is AppVersion here:*14qw14g*_ga*MTg0OTg4NTM3OS4xNjM4NzEzMTM5*_ga_REH9TJF6KF*MTY2MTcyOTI0MC4xNTkuMS4xNjYxNzMwMTA0LjAuMC4w

I did the install instructions there. Then tried to make it work in my Ionic App by

import {AppVersion} from '@awesome-cordova-plugins/app-version'

Then I tried to do a console.log like this:


and it doesn’t work. Wish there was more documentation on React stuff. The error I get is the following:

Module not found: Can't resolve '@awesome-cordova-plugins/core' in '/home/petem/ionic_apps/my_app/node_modules/@awesome-cordova-plugins/app-version'

Here is my Ionic Info:


   Ionic CLI       : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 6.1.10


   Capacitor CLI      : 3.1.1
   @capacitor/android : 3.2.0
   @capacitor/core    : 3.1.1
   @capacitor/ios     : 3.4.0


   cordova-res                          : 0.15.4
   native-run (update available: 1.6.0) : 1.4.0


   NodeJS : v14.17.0 (/usr/local/bin/node)
   npm    : 6.14.13
   OS     : Linux 5.14

edit: I have since ran npm install @awesome-cordova-plugins/core --save

Now my error is:

Module not found: Can't resolve 'rxjs' in '/home/petemo/ionic_apps/my_app/node_modules/@awesome-cordova-plugins/core/decorators'

Module not found: Can't resolve 'rxjs' in '/home/petemo/ionic_apps/my_app/node_modules/@awesome-cordova-plugins/core/decorators'

I don’t know much about this specific plugin, but it seems the original git repo of the cordova plugin is now unmaintained.

If you use package.json to track your app version, you don’t need a plugin; you can pull the version from package.json directly; see this SO question.

Given you are using Ionic React, I am going to assume you are also using Capacitor.

If that is the case, why not just leverage the official App Capacitor Plugin and simply use App.getInfo() to retrieve the version of your app?