electron/rebuild

error rebuild electron 18.0.0 on Windows

songzhj opened this issue · 8 comments

On Mac, electron-rebuild -v 18.0.0 is OK.
On Windows, electron-rebuild -v 17.0.0 will success, but electron-rebuild -v 18.0.0 will get errors:

Building module: tutor-mupdf-addon, Completed: 0

c:\users\feixiang\.electron-gyp\18.0.0\include\node\v8-traced-handle.h(240): error C2061: 语法错误: 标识符“TracedGlobal<`templ
ate-type-parameter-1'>” [D:\code\tutor-mupdf-addon\build\tutor-mupdf-addon.vcxproj]
  c:\users\feixiang\.electron-gyp\18.0.0\include\node\v8-traced-handle.h(335): note: 参见对正在编译的 类 模板 实例化 "v8::TracedGloba
  l<T>" 的引用
c:\users\feixiang\.electron-gyp\18.0.0\include\node\v8-traced-handle.h(240): error C2334: “:”的前面有意外标记;跳过明 显的函数体 [D:\code
\tutor-mupdf-addon\build\tutor-mupdf-addon.vcxproj]
c:\users\feixiang\.electron-gyp\18.0.0\include\node\v8-traced-handle.h(22): fatal error C1075: “{”: 未找到匹配令牌 [D:\code\tu
tor-mupdf-addon\build\tutor-mupdf-addon.vcxproj]
× Rebuild Failed


An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'D:\code\tutor-mupdf-addon'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".


Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe` failed with exit code: 1






Error: node-gyp failed to rebuild 'D:\code\tutor-mupdf-addon'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".


Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe` failed with exit code: 1




    at NodeGyp.rebuildModule (D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\module-type\node-gyp.js:117:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ModuleRebuilder.rebuildNodeGypModule (D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\module-rebuilder.js:94:9)
    at async ModuleRebuilder.rebuild (D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\module-rebuilder.js:124:14)
    at async Rebuilder.rebuildModuleAt (D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\rebuild.js:145:13)
    at async Rebuilder.rebuild (D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\rebuild.js:108:17)
    at async D:\Code\tutor-mupdf-addon\node_modules\electron-rebuild\lib\src\cli.js:154:9
error Command failed with exit code 4294967295.

Why and how to resolve it ?

+1

We had the same problem in a build using Node 14 and Visual Studio 2017 (MSBuild 15). Builds using Node 16 and Visual Studio 2022 (MSBuild 17) do not seem to be affected.

In our concrete case, we worked around the problem by updating our native dependency to a version that has prebuilt binaries for Electron 18.

Same trouble

  • with electron@16 works fine
  • with electron@18 rebuild broken
c:\users\ciber\.electron-gyp\18.0.1\include\node\v8-traced-handle.h(240): error C2061: syntax error: identifier 'Tr
acedGlobal<`template-type-parameter-1'>' [F:\FireSave\release\app\node_modules\greenworks\build\greenworks-win64.vc
xproj]
  c:\users\ciber\.electron-gyp\18.0.1\include\node\v8-traced-handle.h(335): note: see reference to class template i
  nstantiation 'v8::TracedGlobal<T>' being compiled
c:\users\ciber\.electron-gyp\18.0.1\include\node\v8-traced-handle.h(240): error C2334: unexpected token(s) precedin
g ':'; skipping apparent function body [F:\FireSave\release\app\node_modules\greenworks\build\greenworks-win64.vcxp
roj]
c:\users\ciber\.electron-gyp\18.0.1\include\node\v8-traced-handle.h(22): fatal error C1075: '{': no matching token
found [F:\FireSave\release\app\node_modules\greenworks\build\greenworks-win64.vcxproj]

+1

Looks like it works now, dont know what changed, anybody still experience issue?

Might have been fixed by electron/electron#34109

I will try tomorrow and see if I can still reproduce it in my project.

Works again for me too 🚀

I try to electron-rebuild -v 18.0.0 -f -w better-sqlite3 with VS2017, But it throw some c++ compile error.

But it is work in VS2019, so I guess it maybe relate with VS version