Electron Builder - 找不到插件,无法调用 UAC::_

Electron Builder - Plugin not found, cannot call UAC::_

我在构建我的 Electron 应用程序时遇到错误 npm run dist 但我没有找到解决该问题的解决方案。

Command line defined: "COMPRESS=auto"
Command line defined: "BUILD_UNINSTALLER"
Command line defined: "UNINSTALLER_OUT_FILE=C:\laragon\www\app\dist\.__uninstaller-nsis-App_App.exe"
Processing config: C:\Users\User\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.3.2\nsisconf.nsh
Processing script file: "<stdin>" (ACP)

Error output:
Plugin not found, cannot call UAC::_
Error in macro _UAC_MakeLL_Cmp on macroline 2
Error in macro _UAC_IsInnerInstance on macroline 1
Error in macro _If on macroline 9
Error in macro FUNCTION_INSTALL_MODE_PAGE_FUNCTION on macroline 2
Error in macro PAGE_INSTALL_MODE on macroline 17
!include: error in script: "assistedInstaller.nsh" on line 60
Error in script "<stdin>" on line 112 -- aborting creation process
    at ChildProcess.<anonymous> (C:\laragon\www\app\node_modules\builder-util\src\util.ts:244:14)
    at Object.onceWrapper (events.js:288:20)
    at ChildProcess.emit (events.js:200:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! App_App@2.3.0 dist: `build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the App_App@2.3.0 dist 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\User\AppData\Roaming\npm-cache\_logs20-11-04T10_47_57_428Z-debug.log

日志文件内容:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\laragon2\bin\nodejs\node-v12\node.exe',
1 verbose cli   'C:\laragon2\bin\nodejs\node-v12\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dist'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.5.0
4 verbose run-script [ 'predist', 'dist', 'postdist' ]
5 info lifecycle App_App@2.3.0~predist: App_App@2.3.0
6 info lifecycle App_App@2.3.0~dist: App_App@2.3.0
7 verbose lifecycle App_App@2.3.0~dist: unsafe-perm in lifecycle true
8 verbose lifecycle App_App@2.3.0~dist: PATH: C:\laragon2\bin\nodejs\node-v12\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;
9 verbose lifecycle App_App@2.3.0~dist: CWD: C:\laragon\www\app
10 silly lifecycle App_App@2.3.0~dist: Args: [ '/d /s /c', 'build' ]
11 silly lifecycle App_App@2.3.0~dist: Returned: code: 1  signal: null
12 info lifecycle App_App@2.3.0~dist: Failed to exec dist script
13 verbose stack Error: App_App@2.3.0 dist: `build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\laragon2\bin\nodejs\node-v12\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:200:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\laragon2\bin\nodejs\node-v12\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:200:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid App_App@2.3.0
15 verbose cwd C:\laragon\www\app
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\laragon2\bin\nodejs\node-v12\node.exe" "C:\laragon2\bin\nodejs\node-v12\node_modules\npm\bin\npm-cli.js" "run" "dist"
18 verbose node v12.5.0
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error App_App@2.3.0 dist: `build`
22 error Exit status 1
23 error Failed at the App_App@2.3.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 ]

我尝试清理 npm 缓存,删除所有模块并重新安装,删除 electron-builder 缓存,但没有任何反应。

我测试过在其他计算机上构建相同的项目,它工作正常。

有人能解决我的问题吗?

提前致谢

如果有人有类似的错误,我发现了问题:它不能在 electron builder 缓存路径中有 unicode 字符。就我而言,这是我的 windows 用户会话。

更改电子缓存路径:

export ELECTRON_BUILDER_CACHE=C:\Temp

和运行npm run distyarn dist

希望这个回答能对以后的人有所帮助。