问题描述
我正在使用 electron-packager 打包我的应用程序,但没有更改其名称,并且仍然显示Electron".
i'm packaging my application using electron-packager but isn't changing its name, and still display "Electron".
它应该在我的 package.json
中使用 productName
但它没有改变.
it's supposed to use the productName
in my package.json
but it doesn't change.
即使我做了一个安装程序,安装的应用程序的名称、快捷方式和进程仍然是Electron
even if i made an installer, the name of the app installed, shortcut and process still is Electron
我已经读到可能问题出在 electron-prebuilt
但我没有将它作为对我的项目的依赖.
i've read that maybe the problem is electron-prebuilt
but i didn't have it as a dependency on my project.
知道有什么问题吗?
阅读更多关于 electron-packager
的文档有一个特别适用于 windows 的选项.但是当我使用它们时会抛出一个错误:
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"
之前使用 --version-string.ProductName
但现在即使使用它仍然会引发该错误.
before was working with --version-string.ProductName
but now even with it still throws that error.
在这里,我将把我的 packager.json
留给你,它位于我的项目的根目录上
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"
}
}
推荐答案
好的,在尝试和研究之后,我决定通过编程 API 打包我的应用程序
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);
});
这篇关于电子应用程序名称不会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!