Electron-vue: app.getVersion() getting electron lib version and don't updating

Created on 28 Aug 2017  路  5Comments  路  Source: SimulatedGREG/electron-vue

Hello guys , i'm using electron-updater for auto update my app and it's don't work very well , in the console shows
image

Although my application is in version 0.0.1 in package.json

image

why this happen ?

I think de app.getVersion is getting electron lib version , have some configuration to set in electron-updater or in the electron-core lib ?

question

Most helpful comment

@SimulatedGREG Actually you can test updates in development, you just need to mock the app.getVersion function before importing the 'electron-updater' package. Something like:

import {version} from './package.json';
app.getVersion = ()=> version;
const { autoUpdater } = require("electron-updater");

All 5 comments

I am not sure whether this will be helpful in your particular case. But i tried getVersion in my app to show it in About App dialog. I got the same release number. So i figured it was electron's version. So in development mode, it fetches electrons version instead of app's version which is in pacakage.json. But in production build it works perfectly.

I don't know anything about auto update feature yet. but if you are running in development environment, try production build instead.

Thanks man , it's work perfectly now. But it is a pity that don't work in the development environment because it would help me a lot to check methods.
But I can move on now , thank you very much

@CristopherYusuke

The following documentation explains how the app version is attained, but doesn't necessarily mention the differences during development like @emjimadhu mentions.

The version of the loaded application.

It's important to remember that during development you are using a prebuilt binary of electron, and not a final production build that your would normally expect. Since the prebuilt version lives in a separate scope of your project's package.json, it will then fallback to getting the electron version, or the "loaded application".

https://electron.atom.io/docs/api/app/#appgetversion

In short, you can't really test automatic updates in development. Perhaps you could within some sort of staging environment though.

It's a known "issue". I'm using the following to grab the app version
const appVersion = require('./package.json').version;

@SimulatedGREG Actually you can test updates in development, you just need to mock the app.getVersion function before importing the 'electron-updater' package. Something like:

import {version} from './package.json';
app.getVersion = ()=> version;
const { autoUpdater } = require("electron-updater");
Was this page helpful?
0 / 5 - 0 ratings