我对电子助洗剂有疑问。
https://medium.com/how-to-electron/a-complete-guide-to-packaging-your-electron-app-1bdc717d739f
我遵循了使用电子生成器包装电子应用程序的完整指南,但是我不知道为什么我会收到此错误。
任何想法将不胜感激。
这是我正在获取的示例错误日志。
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\ROG\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dist' ]
2 info using npm@6.12.0
3 info using node@v10.16.0
4 verbose run-script [ 'predist', 'dist', 'postdist' ]
5 info lifecycle electron-quick-start@1.0.0~predist: electron-quick-start@1.0.0
6 info lifecycle electron-quick-start@1.0.0~dist: electron-quick-start@1.0.0
7 verbose lifecycle electron-quick-start@1.0.0~dist: unsafe-perm in lifecycle true
8 verbose lifecycle electron-quick-start@1.0.0~dist: PATH: C:\Users\ROG\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\electron-quick-start\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\xampp\php;C:\composer;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Users\ROG\AppData\Local\Microsoft\WindowsApps;C:\Users\ROG\AppData\Roaming\Composer\vendor\bin;C:\Users\ROG\AppData\Roaming\npm;C:\Users\ROG\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ROG\AppData\Local\Yarn\bin
9 verbose lifecycle electron-quick-start@1.0.0~dist: CWD: C:\xampp\htdocs\electron-quick-start
10 silly lifecycle electron-quick-start@1.0.0~dist: Args: [ '/d /s /c', 'build' ]
11 silly lifecycle electron-quick-start@1.0.0~dist: Returned: code: 1 signal: null
12 info lifecycle electron-quick-start@1.0.0~dist: Failed to exec dist script
13 verbose stack Error: electron-quick-start@1.0.0 dist: `build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\ROG\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\ROG\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid electron-quick-start@1.0.0
15 verbose cwd C:\xampp\htdocs\electron-quick-start
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ROG\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dist"
18 verbose node v10.16.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error electron-quick-start@1.0.0 dist: `build`
22 error Exit status 1
23 error Failed at the electron-quick-start@1.0.0 dist script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]```
here is my package.json
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "electron .",
"pack": "build --dir",
"dist": "build"
},
"build": {
"appID": "com.demo.quickstart",
"win": {
"target": ["nsis"],
"icon": "build/icon.ico"
}
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^6.0.12",
"electron-builder": "^21.2.0"
}
}
答案 0 :(得分:0)
此帖子一直没有活跃,所以我将其添加为答案,也许会有所帮助。
我注意到您的directories
中没有package.json
对象。
我不知道这是否至关重要,因为我自己无法解释错误。这是我看到的package.json
与我的和我的工作之间唯一的区别。
它看起来像这样。 output
相对于您的电子应用程序的根目录。
"build": {
"appID": "com.demo.quickstart",
"directories": {
"output": "build"
},
"win": {
"target": ["nsis"],
"icon": "build/icon.ico"
}
}
请让我知道你的情况 希望对您有帮助