Unhandled exception nodehelper.js
Dear MagicMirror community,
I’m rather new to the node.js, Electron and MagicMirror platforms. While my hardware is in the making, I’m getting myself familiar with the various tools, trying to develop my own module. The ‘head first’ post and the ‘module example’ have been quite helpful so far.
Now that I’m taking the first steps into making my own module, I’m getting stuck at the point where I’m trying to include the osmosis package.
I know the osmosis package is working after installation/compiling, since I’m successfully running a separate .js file (in the same folder as my own MM module) with the osmosis package performing the scraping I want. However, once I add a require for the osmosis package into my node_heper, the MagicMirror throws an unhandled exception while initializing this node_helper.
Since my MagicMirror instance is running using pm2, I’ve managed to pull some debug info from the log:
Error: The module '/home/pi/MagicMirror/modules/HelloWorld/node_modules/libxmljs/build/Release/xmljs.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 59. This version of Node.js requires NODE_MODULE_VERSION 57. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).
Probably an easy fix, but I’m not sure how to proceed with these suggestions.
Hope to find anyone with more experience on the node.js side that could explain me how to get the versions of MagicMirror and the osmosis package to match?
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using
right there. go to the osmosis module folder and type npm rebuild
@sdetweil thanks for your suggestion.
Unfortunately it was a little more complicated than that. It took some online research, but it basically came down to rebuilding the dependency libxmljs for Electron. I followed the steps as described in the Electron documentation and it works like a charm now.
@supersook great! Thanks for the feedback. I am sure it will help someone else…