Where does the info in App.getInfo() come from?!

I’m using Capacitor’s App.getInfo() to show the version of my (Vue3) app

I do:

    <PageHeader title="Info"></PageHeader>
    <ion-content :fullscreen="true">
      <p class="centered">v{{version}}</p>

import { App } from '@capacitor/app';
import { IonPage, IonContent } from '@ionic/vue';
import PageHeader from "@/components/PageHeader.vue";

export default defineComponent({
  name: 'Info',
  components: {
  setup() {
    const version = ref('');
    App.getInfo().then(info => {
      version.value = info.version;
  return {

In the app {{version}} shows as “1.0”. My question is, where does that come from? (I can only find a version in package.json and that is currently 0.1.1)

Many thanks!

Ionic 6.18.1
node v17.4.0
npm 9.3.1

And from package.json dependencies:
@capacitor/android”: “3.4.0”,
@capacitor/app”: “^1.1.0”,
@capacitor/browser”: “^1.0.7”,
@capacitor/core”: “^3.4.0”,
@capacitor/haptics”: “1.1.4”,
@capacitor/keyboard”: “1.2.1”,
@capacitor/status-bar”: “1.0.7”,
@capacitor/storage”: “^1.2.5”,
@ionic/vue”: “^6.0.0”,
@ionic/vue-router”: “^6.0.0”,
“axios”: “^0.26.0”,
“core-js”: “^3.6.5”,
“vue”: “^3.2.21”,
“vue-router”: “^4.0.12”,
“vuex”: “^4.0.2”

The source code for Android is here. My guess is that it is from the file android/app/build.gradle and versionName as that is the version Google pulls for the Android build.

For iOS, the versions you have to maintain are in ios/App/App.xcodeproj/project.pbxproj so assuming that is where it gets pulled.

MARKETING_VERSION = 0.2.0; // It is in the file twice. Both have to be changed.

If you are looking to get the version from your package.json file, you can do the following (I just had to do this :slight_smile:) - source.


// Add this line above module.exports
process.env.VUE_APP_VERSION = require('./package.json').version

Then within your app you just do process.env.VUE_APP_VERSION.

UPDATE - 2022-04-07
Just noticed that the documentation here also states where the version is from which confirms of where I thought it was being pulled from.

The app version. On iOS it’s the CFBundleShortVersionString. On Android it’s package’s versionName.

Many thanks! I don’t have a vue.config.js in my project for some reason… so, based on that doc page I just set an env variable for it instead. Would like to know why I don’t have a vue.config.js - but that another question! :slightly_smiling_face:

You should be able to just create the vue.config.js file in your project’s root.

Ah yes! Just created a vue.config.js with that one line in it (removed my substitute env variable), rebuild and it worked directly from the package.json version. Thank you :grinning:

1 Like