下面是我的package.js中的配置:
{ "name": "**", "version": "2.0.0", "description": "**", "main": "main.js", "scripts": { "build": "electron-builder", "build:dir": "electron-builder --dir" }, "devDependencies": { "electron": "^8.1.1", "electron-builder": "^22.4.1", "electron-updater": "^4.2.5" }, "build": { "productName":"***", "appId": "com.***", "copyright":"**", "directories": { "output": "build" }, "asar": false, "nsis": { "oneClick": false, "allowElevation": true, "allowToChangeInstallationDirectory": true, "installerIcon": "clientLogo.ico", "uninstallerIcon": "clientLogo.ico", "installerHeaderIcon": "clientLogo.ico", "createDesktopShortcut": true, "createStartMenuShortcut": true, "shortcutName": "***", "include": "build/script/installer.nsh" }, "publish": [ { "provider": "generic", "url": "C:\\Users\\Shinelon\\Desktop\\*****\\myApp" } ], "files": [ "dist/electron/**/*" ], "dmg": { "contents": [ { "x": 410, "y": 150, "type": "link", "path": "/Applications" }, { "x": 130, "y": 150, "type": "file" } ] }, "win": { "icon": "clientLogo.ico", "target": [ { "target": "nsis" } ] }, "linux": { "icon": "build/icons" } } }
下面是我的错误日志:
9 verbose lifecycle '项目'@2.0.0~build: CWD: C:\Users\Shinelon\Desktop\'项目'在线更新版本测试\'项目'(在线更新版本测试)
10 silly lifecycle '项目'@2.0.0~build: Args: [ '/d /s /c', 'electron-builder' ]
11 silly lifecycle '项目'@2.0.0~build: Returned: code: 1 signal: null
12 info lifecycle '项目'@2.0.0~build: Failed to exec build script
13 verbose stack Error: '项目'@2.0.0 build: `electron-builder`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:321:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid '项目'@2.0.0
15 verbose cwd C:\Users\Shinelon\Desktop\'项目'在线更新版本测试\'项目'(在线更新版本测试)
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.16.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error '项目'@2.0.0 build: `electron-builder`
22 error Exit status 1
23 error Failed at the '项目'@2.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
ps:再上面几条粘不开了