Electron app name doesn't change

2019-04-17 11:37发布

i'm packaging my application using electron-packager but isn't changing its name, and still display "Electron".

it's supposed to use the productName in my package.json but it doesn't change.

even if i made an installer, the name of the app installed, shortcut and process still is Electron

i've read that maybe the problem is electron-prebuilt but i didn't have it as a dependency on my project.

Any idea what is wrong?

Edit:

reading more on the documentation of electron-packager there's an options especially to windows. but when i use them throws me an error:

Fatal error: Unable to commit changes
undefined

the first time i used them was "working" good packaging my app, but still displaying wrong the appname

electron-packager ./ --platform=win32 --arch=ia32 --overwrite=true --appname="TierraDesktop" --version-string.ProductName="TierraDesktop" --version-string=InternalName="TierraDesktop" --version-string.CompanyName="Cosmica" --version-string.FileDescription="Sistema de gestion comercial" --version-string.OriginalFilename="TierraDesktop"

before was working with --version-string.ProductName but now even with it still throws that error.

here i'll leave you my packager.json that's on the root of my project

{
"name": "TierraDesktop",
"productName": "TierraDesktop",
"version": "2.0.5",
"description": "Aplicacion de escritorio tierra de colores",
"main": "main.js",
"scripts": {
    "start": "electron main.js"
},
"repository": {
    "type": "git",
    "url": "git+https://github.com/xxxx/xxxxx.git"
},
"author": "xxxxx",
"devDependencies": {
    "debug-menu": "^0.4.0",
    "electron-winstaller": "^2.3.3"
},
"dependencies": {
    "electron-json-storage": "^2.0.0"
}
}

Executable

Process name

Application name

4条回答
我只想做你的唯一
2楼-- · 2019-04-17 12:15

@Paulo Galdo Sandoval's answer is correct for electron-packager, but as of version 9.0.0 of the package, it automatically grabs information for those fields (version-string is now win32metadata). See the release notes for that package

查看更多
Deceive 欺骗
3楼-- · 2019-04-17 12:21

Ok after trying and researching i've decided to package my application via programmatic API

with this script i can achieve all what i want. hope this help someone with the same problem.

var packager = require('electron-packager');
var options = {
    'arch': 'ia32',
    'platform': 'win32',
    'dir': './',
    'app-copyright': 'Paulo Galdo',
    'app-version': '2.0.5',
    'asar': true,
    'icon': './app.ico',
    'name': 'TierraDesktop',
    'ignore': ['./releases', './.git'],
    'out': './releases',
    'overwrite': true,
    'prune': true,
    'version': '1.3.2',
    'version-string':{
      'CompanyName': 'Paulo Galdo',
      'FileDescription': 'Tierra de colores', /*This is what display windows on task manager, shortcut and process*/
      'OriginalFilename': 'TierraDesktop',
      'ProductName': 'Tierra de colores',
      'InternalName': 'TierraDesktop'
    }
};
packager(options, function done_callback(err, appPaths) {
    console.log(err);
    console.log(appPaths);
});
查看更多
ら.Afraid
4楼-- · 2019-04-17 12:30

electron-packager checks the output directory for an existing package based on the version name. If you did not change the version name when you tried to re-package with a different product name, electron-packager probably told you in the console that it was skipping the packaging process because a package already exists.

查看更多
老娘就宠你
5楼-- · 2019-04-17 12:33
electron-packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...]

If appname is omitted, this will use the name specified by "productName" or "name" in the nearest package.json.

Have you tried to set the 'name' property in package.json?

查看更多
登录 后发表回答