我在电子应用程序中使用包bigint-buffer“^1.1.5”。更新包 electro-builder 后,项目未构建。有错误
Error: spawn C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin',
path: 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin',
spawnargs: [
'build/binding.sln',
'/clp:Verbosity=minimal',
'/nologo',
'/p:Configuration=Release;Platform=x64'
]
}
⨯ node-gyp failed to rebuild 'C:\Users\admin\wd\node_modules\bigint-buffer' failedTask=build stackTrace=Error: node-gyp
failed to rebuild 'C:\Users\admin\wd\node_modules\bigint-buffer'
at ChildProcess.<anonymous> (C:\Users\admin\wd\node_modules\@electron\rebuild\src\module-type\node-gyp\node-gyp.ts:131:
16)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
bigint-buffer 包在 @solana/web3.js 包中使用
我在 POC 项目中遇到了类似的问题,错误消息表明 Msbuild 的生成过程中存在问题。您可以尝试下面列出的几个步骤 -
如果您的系统上安装了 MSBuild,请确保路径路径 错误消息中指定的内容正确且有效 - 来自错误 我们可以看到它试图从
RUN
Msbuild
C:\程序 文件\Microsoft Visual Studio�2\Community\Msbuild\Current\Bin
.
检查您使用的 Electron 版本与
bigint-buffer
套餐
..
检查 Node.js 和 npm 的兼容版本
重建 Node.js 插件:尝试为您的项目重建 Node.js 插件 电子项目。尝试使用 Electron-rebuild 包来重建原生 针对您拥有的 Electron 版本的 Node.js 模块 安装。在项目目录中运行以下命令:
bash
Copy your code
npm install --save-dev electro-rebuild
npx 电子重建
上述命令将重建原生 Node.js 模块 对于电子。
让我知道这是否有效。