問題描述
我正在使用 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);
});
這篇關于電子應用程序名稱不會改變的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!