question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron rebuild fails on Windows

See original GitHub issue

What is wrong?

After installing brain.js, trying to run my electron app gives a node_module_version mismatch and when trying to run electron-rebuild.cmd a linker error is throwed

Where does it happen?

At electron’s start (window doesn’t show up, only an error dialog about node_module_version appears) and when executing electron-rebuild.cmd

How do we replicate the issue?

  • Install brain.js
  • Import it in main.js
  • Run Electron (and fail)
[1] 
[1] App threw an error during load
[1] Error: The module '\\?\C:\MX\Chero\node_modules\gl\build\Release\webgl.node'
[1] was compiled against a different Node.js version using
[1] NODE_MODULE_VERSION 72. This version of Node.js requires
[1] NODE_MODULE_VERSION 82. Please try re-compiling or re-installing
[1] the module (for instance, using `npm rebuild` or `npm install`).
[1]     at process.func [as dlopen] (electron/js2c/asar.js:140:31)
[1]     at Object.Module._extensions..node (internal/modules/cjs/loader.js:1196:18)
[1]     at Object.func [as .node] (electron/js2c/asar.js:140:31)
[1]     at Module.load (internal/modules/cjs/loader.js:981:32)
[1]     at Module._load (internal/modules/cjs/loader.js:881:14)
[1]     at Function.Module._load (electron/js2c/asar.js:769:28)
[1]     at Module.require (internal/modules/cjs/loader.js:1023:19)
[1]     at require (internal/modules/cjs/helpers.js:77:18)
[1]     at bindings (C:\MX\Chero\node_modules\bindings\bindings.js:112:48)
[1]     at Object.<anonymous> (C:\MX\Chero\node_modules\gl\src\javascript\native-gl.js:1:40)

  • Run electron-rebuild (and fail again)
| Building module: gl, Completed: 0gyp info find Python using Python version 2.7.18 found at "C:\Python27\python.exe"
| Building module: gl, Completed: 0gyp info find VS using VS2017 (15.9.28307.1274) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\gl\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\gl\\10.1.5\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\MX\\Chero\\node_modules\\gl\\10.1.5',
gyp info spawn args   '-Dnode_gyp_dir=C:\\MX\\Chero\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\MX\\\\Chero\\\\node_modules\\\\gl\\\\10.1.5\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\MX\\Chero\\node_modules\\gl',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\gl\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
\ Building module: gl, Completed: 0gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64',
gyp info spawn args   map: [Function]
gyp info spawn args ]
| Building module: gl, Completed: 0Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
\ Building module: gl, Completed: 0  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/libEGL.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/d3dcompiler_47.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/libGLESv2.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
- Building module: gl, Completed: 0  bindings.cc
| Building module: gl, Completed: 0c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9113): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9121): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
| Building module: gl, Completed: 0  webgl.cc
- Building module: gl, Completed: 0c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9113): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9121): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
/ Building module: gl, Completed: 0c:\mx\chero\node_modules\gl\src\native\webgl.cc(463): warning C4312: 'reinterpret_cast': conversione da 'GLint' a 'GLvoid *', di dimensioni maggiori [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
| Building module: gl, Completed: 0  procs.cc
- Building module: gl, Completed: 0c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9113): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(9121): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\mx\chero\node_modules\gl\10.1.5\include\node\v8.h(7322): note: vedere la dichiarazione di 'v8::MicrotasksCompletedCallback'
- Building module: gl, Completed: 0  win_delay_load_hook.cc
/ Building module: gl, Completed: 0     Creazione della libreria C:\MX\Chero\node_modules\gl\build\Release\webgl.lib e dell'oggetto C:\MX\Chero\node_modules\gl\build\Release\webgl.exp
- Building module: gl, Completed: 0webgl.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QE
AA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) non risolto nella funzione "public: __cdecl Nan::TypedArrayContents<char>::TypedArrayContents<char>(class v8::Local<class v8::Value>)" (??0?$TypedArrayContents@D@Nan@@QEAA@V?$Loca
l@VValue@v8@@@v8@@@Z) [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
C:\MX\Chero\node_modules\gl\build\Release\webgl.node : fatal error LNK1120: 1 esterni non risolti [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'C:\MX\Chero\node_modules\gl'.
Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1



Error: node-gyp failed to rebuild 'C:\MX\Chero\node_modules\gl'.
Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1


    at ModuleRebuilder.rebuildNodeGypModule (C:\MX\Chero\node_modules\electron-rebuild\lib\src\module-rebuilder.js:193:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Expected behavior

I don’t know if it’s usual that it throws the node module mismatch on windows, but I think it should build also with electron-rebuild(?), at least it does with simple npm build/rebuild.

Version information

Nodejs: v12.18.3

Electron: 10.1.5

Electron-rebuild: 2.3.2

Brain.js: 2.0.0-beta.2

How important is this (1-5)?

5, can’t run my app on Windows

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MassimoMendozzacommented, Nov 2, 2020

Already did it all, but the errors are still here. I even tried to repeat the procedure in a new Windows 10 VM, nothing changed.

I tried to go further following the electron’s guide for building native modules with node-gyp and it’s stuck on this error:

PS C:\MX\Chero\node_modules\gl> node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@12.18.3 | win32 | x64
gyp info find Python using Python version 2.7.18 found at "C:\Python27\python.exe"
gyp info find VS using VS2017 (15.9.28307.1274) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\Max\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\gl\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Max\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Max\\AppData\\Local\\node-gyp\\Cache\\iojs-1.2.3\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Max\\AppData\\Local\\node-gyp\\Cache\\iojs-1.2.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Max\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Max\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\iojs-1.2.3\\\\<(target_arch)\\\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\MX\\Chero\\node_modules\\gl',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\MX\\Chero\\node_modules\\gl\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/libEGL.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/d3dcompiler_47.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
  Copying C:\MX\Chero\node_modules\gl/deps/windows/dll/x64/libGLESv2.dll to C:\MX\Chero\node_modules\gl\build\Release
          1 file copiati.
  bindings.cc
  webgl.cc
c:\mx\chero\node_modules\gl\src\native\webgl.cc(463): warning C4312: 'reinterpret_cast': conversione da 'GLint' a 'GLvoid *', di dimensioni maggiori [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(484): warning C4267: 'argomento': conversione da 'size_t' a 'GLsizei'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(494): warning C4267: 'argomento': conversione da 'size_t' a 'GLsizei'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(504): warning C4267: 'argomento': conversione da 'size_t' a 'GLsizei'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(782): warning C4244: '*=': conversione da 'double' a 'unsigned char'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(784): warning C4244: 'inizializzazione': conversione da 'double' a 'float'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(785): warning C4244: '*=': conversione da 'float' a 'unsigned char'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(786): warning C4244: '*=': conversione da 'float' a 'unsigned char'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(787): warning C4244: '*=': conversione da 'float' a 'unsigned char'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(794): warning C4244: 'inizializzazione': conversione da 'double' a 'float'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(795): warning C4244: '*=': conversione da 'float' a 'int'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(796): warning C4244: '*=': conversione da 'float' a 'int'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(797): warning C4244: '*=': conversione da 'float' a 'int'. Possibile perdita di dati. [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
c:\mx\chero\node_modules\gl\src\native\webgl.cc(2084): error C2039: 'ToChecked': non è un membro di 'v8::Maybe<uint32_t>' [C:\MX\Chero\node_modules\gl\build\webgl.vcxproj]
  c:\users\max\appdata\local\node-gyp\cache\iojs-1.2.3\deps\v8\include\v8.h(2034): note: vedere la dichiarazione di 'v8::Maybe<uint32_t>'
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Max\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Max\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.2.3" "--arch=x64" "--dist-url=https://electronjs.org/headers"      
gyp ERR! cwd C:\MX\Chero\node_modules\gl
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
0reactions
robertleeplummerjrcommented, Apr 13, 2022

This is an issue with https://github.com/stackgl/headless-gl, a dependency of GPU.js which is a peer-dependency of brain. Please communicate your issues there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in electron-rebuild serialport on Windows - Stack Overflow
The serialport library doesn't work automatically. Searching in the Readme.md, I figure out that is needed to recompile the library for the ...
Read more >
Can't resolve electron-rebuild errors · Issue #2531 - GitHub
I'm trying to run my app with blake2 module installed. ... These are the steps I followed: install electron-rebuild package; remove blake2 folder ......
Read more >
electron-rebuild - npm
Electron supporting package to rebuild native node modules against the currently installed electron. Latest version: 3.2.9, last published: ...
Read more >
Native Node Modules | Electron
When in doubt, run electron-rebuild first. Make sure the native module is compatible with the target platform and architecture for your Electron app....
Read more >
electron-rebuild | Yarn - Package Manager
This executable rebuilds native Node.js modules against the version of Node.js that your Electron project is using. This allows you to use native...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found