node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Can't resolve electron-rebuild errors

Open roberto-sanfelice opened this issue 4 years ago • 2 comments

I'm trying to run my app with blake2 module installed. I get this error:

Error: The module '\\?\C:\Users\user\Desktop\app\node_modules\blake2\build\Release\binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. This version of Node.js requires
NODE_MODULE_VERSION 98. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1800)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1170:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1800)
    at Module.load (node:internal/modules/cjs/loader:982:32)
    at Module._load (node:internal/modules/cjs/loader:823:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Module.require (node:internal/modules/cjs/loader:1006:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (C:\Users\user\Desktop\app\node_modules\blake2\index.js:9:17)
    at Module._compile (node:internal/modules/cjs/loader:1110:14) {
  code: 'ERR_DLOPEN_FAILED'
}

These are the steps I followed:

  • install electron-rebuild package
  • remove blake2 folder from node_module
  • remove package-lock.json file
  • npm install
  • .\node_module\.bin\electron-rebuild.cmd

But at the last command, I get this error:

× Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'C:\Users\user\Desktop\app\node_modules\blake2'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: Could not find any Visual Studio installation to use



Error: node-gyp failed to rebuild 'C:\Users\user\Desktop\app\node_modules\blake2'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: Could not find any Visual Studio installation to use


    at NodeGyp.rebuildModule (C:\Users\user\Desktop\app\node_modules\electron-rebuild\lib\src\module-type\node-gyp.js:109:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ModuleRebuilder.rebuildNodeGypModule (C:\Users\user\Desktop\app\node_modules\electron-rebuild\lib\src\module-rebuilder.js:94:9)
    at async Rebuilder.rebuildModuleAt (C:\Users\user\Desktop\app\node_modules\electron-rebuild\lib\src\rebuild.js:226:9)
    at async Rebuilder.rebuild (C:\Users\user\Desktop\app\node_modules\electron-rebuild\lib\src\rebuild.js:184:17)
    at async C:\Users\user\Desktop\app\node_modules\electron-rebuild\lib\src\cli.js:154:9

I don't understand what's happening 'cause Python, Visual Studio Community 2019, Visual Studio build tools 2019 with Visual C++ build tools are installed. Does anybody met the same issues?

roberto-sanfelice avatar Oct 22 '21 21:10 roberto-sanfelice

Apple silicon M1 Node v16 Electron 11

npm ERR! gyp info using [email protected]

VadimCiv avatar Oct 25 '21 13:10 VadimCiv

@VadimCiv Your issue is unrelated to the Windows-based issue of the original post.

npm ERR! gyp info using [email protected]

The current version of this repo is v8.3.0. https://github.com/nodejs/node-gyp/releases

  • Please upgrade via https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md

cclauss avatar Oct 25 '21 13:10 cclauss

https://www.npmjs.com/package/electron-rebuild is deprecated in favor of https://www.npmjs.com/package/@electron/rebuild but that uses Python 2 which died on 1/1/2020 so node-gyp has not supported it for several years.

cclauss avatar Jun 13 '23 09:06 cclauss