【发布时间】:2019-09-11 12:07:59
【问题描述】:
我正在尝试使用electron-builder 生成一个 exe 文件不是安装程序所以我尝试将目标设置为可移植
{
"name": "hello-world",
"version": "1.0.0",
"description": "a hello world",
"main": "index.js",
"scripts": {
"start": "electron .",
"dist": "build"
},
"author": "KR",
"license": "ISC",
"devDependencies": {
"electron": "^4.1.4",
"electron-builder": "^20.39.0"
},
"build":{
"appId": "com.whatever.helloworld",
"win":{
"target": ["portable"],
"icon" : "build/icon.ico"
}
}
}
但是,当我尝试 npm run dist 时,我得到了
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
• electron-builder version=20.39.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=4.1.4 appOutDir=dist\win-unpacked
• default Electron icon is used reason=application icon is not set
• building target=portable file=dist\hello-world 1.0.0.exe archs=x64
程序永远卡住了。当我打破它时(ctrl-c),它说
Error: Exit code: 255. Command failed: D:\electrontest\hello-world\node_modules\7zip-bin\win\x64\7za.exe a -bd -mx=9 -mtc=off -mtm=off -mta=off D:\electrontest\hello-world\dist\hello-world-1.0.0-x64.nsis.7z .
所以我猜程序卡在 7za 压缩中。
我搜索了一下,没有使用电子生成器的例子,只有少数带有 nsis。 (我还有一个问题,但首先我想了解一下基础知识)。
【问题讨论】: