#Serialport NODE_MODULE_VERSION issue

12 messages · Page 1 of 1 (latest)

deft cairn
#

Hi, I am having a problem with serialport with johnnyfive. Just serial port works fine in electron, but with johnnyfive it throws an error:

was compiled against a different Node.js version using
NODE_MODULE_VERSION 115. This version of Node.js requires
NODE_MODULE_VERSION 116. 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:2:2131)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1356:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2131)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at bindings (.....\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (.....\node_modules\@serialport\bindings\lib\win32.js:1:36)```

I have tried all node version to match module version, but seems that I cant get to 116. I've tried elecron-rebuild, npm rebuild.. nothing works.

package.json
```...
"dependencies": {
    ...
    "ad-ngx-electron": "^3.0.0-beta.3",
    "johnny-five": "^2.1.0",
    "ngx-electron": "^2.2.0",
    "rxjs": "~7.8.0",
    "serialport": "^12.0.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
"devDependencies": {
    ...
    "electron": "^26.6.9",
    "electron-rebuild": "^3.2.9",

main.js

// this works fine
const { SerialPort } = require('serialport');
const port = new SerialPort({ path: 'COM4', baudRate: 9600 });
....

// this causes error
var five = require("johnny-five");
var board = new five.Board({ port: 'COM6'});
board.on("ready", function() {
 ...
});
....```


win10 64bit, node v 20.11.0
Thanks!
deft cairn
#

now i have "electron": "^28.2.2", and using node v18.18.2 which is same as in electron 28.2.2 and still same error

deft cairn
#

With this i get

was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 119. Please try re-compiling or re-installing```

process.versions

{
node: '18.18.2',
acorn: '8.10.0',
ada: '2.6.0',
ares: '1.19.1',
brotli: '1.0.9',
cldr: '43.0',
icu: '73.1',
llhttp: '6.0.11',
modules: '119',
napi: '9',
nghttp2: '1.57.0',
openssl: '1.1.1',
simdutf: '3.2.14',
tz: '2023c',
undici: '5.26.3',
unicode: '15.0',
uv: '1.44.2',
uvwasi: '0.0.18',
v8: '12.0.267.19-electron.0',
zlib: '1.2.13.1-motley',
electron: '28.2.2',
chrome: '120.0.6099.276'
}```
its weird that node is v18.18.2 & modules 119, while on https://nodejs.org/dist/index.json says that node v18.18.2 has modules 108

eternal depot
deft cairn
#

already tried these with no success

eternal depot
#

there is no other suggestion

deft cairn
#

any way to build with built-in node?

eternal depot
#

without rebuild no

#

i am not sure if serialport support such node version

deft cairn
#

huh now somehow it worked.. dont know how, tried so many diff things 😄

deft cairn
#

thanks for help

tender tendon
#

@deft cairn can you remember at all how you solved this? Stuck on same thing