详细描述(引用github一位博主)
Version: 19.56.2
Target: win10 64
When I run npm run dev my app works fine.
OKAY take it away electron-builder
• electron-builder version=19.56.2
• loaded configuration file=package.json (“build” field)
• no native production dependencies
• packaging platform=win32 arch=ia32 electron=1.8.7 appOutDir=build\win-ia32-unpacked
• building target=nsis file=build\xiucan Setup 0.0.0.exe archs=ia32 oneClick=true
Error: C:\Users\MuBan\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.13\Bin\makensis.exe exited with code 1
Output:
Command line defined: “APP_ID=org.simulatedgreg.electron-vue”
Command line defined: “APP_GUID=62e3eecb-e013-549b-8222-3caf500ba8f3”
Command line defined: “PRODUCT_NAME=xiucan”
Command line defined: “PRODUCT_FILENAME=xiucan”
Command line defined: “APP_FILENAME=xiucan”
Command line defined: “APP_DESCRIPTION=xiucan”
Command line defined: “VERSION=0.0.0”
Command line defined: “PROJECT_DIR=D:\ѧϰ\electron\xiucan”
Command line defined: “BUILD_RESOURCES_DIR=D:\ѧϰ\electron\xiucan\build”
Command line defined: “MUI_ICON=D:\ѧϰ\electron\xiucan\build\icons\icon.ico”
Command line defined: “MUI_UNICON=D:\ѧϰ\electron\xiucan\build\icons\icon.ico”
Command line defined: “APP_32=D:\ѧϰ\electron\xiucan\build\xiucan-0.0.0-ia32.nsis.7z”
Command line defined: “APP_32_NAME=xiucan-0.0.0-ia32.nsis.7z”
Command line defined: “APP_32_HASH=CEFD5467CF4F6FA191963DDF0B5AE426974F58C67479C499AC561A843C64DB2543D13A795B86B39D2D5447F553E4D4E3C0657EBE4CC706D91BB5315081309907”
Command line defined: “COMPANY_NAME=FANG”
Command line defined: “APP_INSTALLER_STORE_FILE=xiucan\installer.exe”
Command line defined: “COMPRESSION_METHOD=7z”
Command line defined: “ONE_CLICK”
Command line defined: “RUN_AFTER_FINISH”
Command line defined: “SHORTCUT_NAME=xiucan”
Command line defined: “UNINSTALL_DISPLAY_NAME=xiucan 0.0.0”
Command line defined: “COMPRESS=auto”
Command line defined: “BUILD_UNINSTALLER”
Command line defined: “UNINSTALLER_OUT_FILE=D:\ѧϰ\electron\xiucan\build.__uninstaller-nsis-xiucan.exe”
Processing config: C:\Users\MuBan\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.13\nsisconf.nsh
Processing script file: “” (ACP)
Error output:
!include: could not find: “D:\学习\electron\xiucan\node_modules_electron-builder-lib@19.56.2@electron-builder-lib\templates\nsis\include\StdUtils.nsh”
Error in script “” on line 1 – aborting creation process
at ChildProcess.childProcess.once.code (D:\学习\electron\xiucan\node_modules\_builder-util@4.2.4@builder-util\src\util.ts:241: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)
解决方法:项目完整目录不能包含中文,把中文改成英文再运行:npm run electron:build可完成编译