Closed AlCalzone closed 4 years ago
I'd like this to be in the next version... too many users asking the same dumb question and never reading the log output.
This works great for adapters but how we handle it for controller? I think it is mainly fsevents und unix-dgram ... so we would need to find alternatives here to stay" native free" on controller level?
oder einen speziellen "iobroker upgrade node" befehl der das für den controller richtet
Hmm, can we isolate which modules need those dependencies? Then we could try/catch the require of those modules and handle them like in adapters.
Should be visible in a clean install of the npm of package or?! As said I think Unix-dgram sms fsevents (macOS)
Ok, here an example error message. On what we shopuld try to detect it?
2020-02-20 14:19:52.814 - error: host.local.compactgroup1 Cannot start mbus.0 in compact mode. Fallback to normal start! : The module '/Volumes/Dev/iobroker/node_modules/node-mbus/build/Release/mbus.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
2020-02-20 14:19:52.815 - error: undefined
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: /Volumes/Dev/iobroker/node_modules/bindings/bindings.js:121
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: throw e;
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: ^
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: Error: The module '/Volumes/Dev/iobroker/node_modules/node-mbus/build/Release/mbus.node'
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: was compiled against a different Node.js version using
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: NODE_MODULE_VERSION 64. This version of Node.js requires
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: the module (for instance, using `npm rebuild` or `npm install`).
2020-02-20 14:19:53.116 - error: host.local.compactgroup1 Caught by controller[0]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:1208:18)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at require (internal/modules/cjs/helpers.js:77:18)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at bindings (/Volumes/Dev/iobroker/node_modules/bindings/bindings.js:112:48)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Object.<anonymous> (/Volumes/Dev/iobroker/node_modules/node-mbus/index.js:7:38)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-02-20 14:19:53.117 - error: host.local.compactgroup1 Caught by controller[0]: at Module.load (internal/modules/cjs/loader.js:1002:32)
I feel good with Option 2 or 1 (in that order).
Additionally ... Should not "npm rebuild" in the folder enough?
I would prefer NODE_MODULE_VERSION
because it sounds like a constant string which is unlikely to change and I've only ever seen it in this error message.
npm install
could easily be part of an instruction for the user to install a required module, so that's a no for me.
was compiled against a different Node.js version
is natural language and I would expect it to change in future versions.
Additionally ... Should not "npm rebuild" in the folder enough?
I'm not sure - I've seen reports where npm rebuild
had no effect and npm install --production
did work. Most likely because rebuild did not affect the dependencies and npm install
basically reinstalls all deps.
Ok. Then we run install.
see https://github.com/ioBroker/ioBroker.js-controller/pull/683 ... I used "NODE_MODULE_VERSION" and "npm rebuild" as detection strings and execute npm install
ooook ... I needed to change some stuff to make sure that not multiple npm commands run in parallel. Then while testing I had one case where "npm install" was successful but instance still did not started with incompatibility error. solution was "npm rebuild". :-(
So we need to rethink again.
Idea: first try is using rebuild, second+ try use install ...
https://forum.iobroker.net/topic/26990/zigbee-und-ble-problem The error message is always the same. JS-Controller could detect this and instead of spamming the log, run
npm install --production
in the affected adapter's directory.