0

Until recently, the guidance described in Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51 has succeeded to overcome the following 'npm start run' failure:

    App threw an error during load
    Error: The module '\\? 
    \G:\CodeDev\AlfatronController2\node_modules\@serialport\bindings\build\Release\bindings.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 72. This version of Node.js requires
    NODE_MODULE_VERSION 87. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1846)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1138:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1846)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at bindings (G:\CodeDev\AlfatronController2\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> 
    (G:\CodeDev\AlfatronController2\node_modules\@serialport\bindings\lib\win32.js:1:36)

Specifically, the recommended command sequence

    rm -rf node_modules
    rm package-lock.json
    npm i
    ./node_modules/.bin/electron-rebuild

has worked reliably (for months) prior to recent upgrade to Electron 12.0.0, but the rebuild (which now completes in just a few seconds) no longer overcomes the reported failure.

What sequence of commands should be executed to overcome this issue? Why is the former method no longer valid, or what residual condition exists to flag the error NODE_MODULE_VERSION 72 versus the required NODE_MODULE_VERSION 87?

Software versions deployed under Windows 10 are:

Node: 12.18.3
npm: 7.6.0
electron: 12.0.0
electron-rebuild: 2.3.5
serialport: 9.0.7
puzzler
  • 51
  • 2
  • 8

1 Answers1

0

My error: serialport declared under "devDependencies" instead of "dependencies" in package.json file.

While error reporting is somewhat obscure, the recommended command sequence does work following appropriate declaration of serialport in package.json.

puzzler
  • 51
  • 2
  • 8