npm run buildwin
> study01@1.0.0 buildwin F:\Nodejs\electron\Test\study01
> electron-builder --platform=win --arch=x64
• electron-builder version=20.28.4
• loaded configuration file=package.json ("build" field)
• Specified application directory equals to project dir — superfluous or wrong configuration appDirectory=./
• description is missed in the package.json appPackageFile=F:\Nodejs\electron\Test\study01\package.json
• writing effective config file=dist\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=2.0.9 appOutDir=dist\win-unpacked
• cannot unpack electron zip file, will be re-downloaded error=zip: not a valid zip file
⨯ zip: not a valid zip file
Error: D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_app-builder-bin@2.1.2@app-builder-bin\win\x64\app-builder.exe exited with code 1
at ChildProcess.childProcess.once.code (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_builder-util@6.1.3@builder-util\src\util.ts:254:14)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
at Promise.longStackTracesCaptureStackTrace [as _captureStackTrace] (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_bluebird@3.5.2@bluebird\js\release\debuggability.js:411:19)
at Promise._then (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_bluebird@3.5.2@bluebird\js\release\promise.js:232:17)
at Promise.then (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_bluebird@3.5.2@bluebird\js\release\promise.js:125:17)
at Object.args [as handler] (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\src\cli\cli.ts:42:48)
at Object.runCommand (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_yargs@12.0.2@yargs\lib\command.js:238:44)
at Object.parseArgs [as _parseArgs] (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_yargs@12.0.2@yargs\yargs.js:1085:24)
at Object.get [as argv] (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\node_modules\_yargs@12.0.2@yargs\yargs.js:1000:21)
at Object.<anonymous> (D:\Program Files\node-v8.9.3-win-x64\node_modules\electron-builder\src\cli\cli.ts:25:28)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! study01@1.0.0 buildwin: `electron-builder --platform=win --arch=x64`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the study01@1.0.0 buildwin script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dong\AppData\Roaming\npm-cache\_logs\2018-09-12T23_36_21_615Z-debug.log
========================================
C:\Users\dong\AppData\Local\electron\Cache\electron-v2.0.9-win32-x64.zip 这个文件损坏删除 重新运行由于网速慢,可能还会报错,可下载将文件复制到此目录下,重新执行打包命令即可解决
地址:https://github.com/electron/electron/releases/download/v2.0.9/electron-v2.0.9-win32-x64.zip