Different compiling version while trying to run an electron project - node.js

I currently an trying to make a node js project using electron and node-gyp for c addons. But when I try to run my program using
electron index.js
I get this error:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/ubspy/Code/Node-c-test/build/Release/addons.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
at process.module.(anonymous function) [as dlopen]
I've tried reinstalling all the packages, and recompiling all the source code, I don't know what's wrong.

I figured it out after many a trial and error, after upgrading electron to the most recent beta version the module versions matched, and the program ran flawlessly.

Related

How to update the NodeJS version in linux? (Issue occurs when trying to install jsreport-pdf-password)

2019-04-04T04:34:49.035Z - error: Error when loading extension Error: The module '/media/vishesh/Disc/working/examples/jsreport_pdf_password_install_tryout/node_modules/jsreport-pdf-password/node_modules/hummus/binding/hummus.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. 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`).
Error: The module '/media/vishesh/Disc/working/examples/jsreport_pdf_password_install_tryout/node_modules/jsreport-pdf-password/node_modules/hummus/binding/hummus.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. 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`).
I have tried downgrading node version using nvm. I have successfully done it and reduce to the required version (i.e)8.9.1. Thus when i check the command "node -v" i get 8.9.1.
But when i check "nodejs -v" i only get 11.9.0. Thus the above mentioned error occurred. I am unable to identify how to change the nodejs version also ? Any ideas ?
Also, i have tried installing "jsreport-pdf-password" with same version 11.9.0 in node and nodejs in a completely different folder and also by deleting the node_modules. Still getting this error.
After downloading node version using the command nvm install 8.9.1, it will download that version but won't use it. To use version 8.9.1 you have to run another command nvm use 8.9.1. Then your node version manager will start to use 8.9.1.
I got it. I searched in stackoverflow for a while and got in a post that node is the alias used by npm for nodejs. The nodejs is alias of nodejs version that the ubuntu os installs. Thus i removed the nodejs using this command "sudo apt-get remove nodejs".
Then i used nvm and set 7.10.0 as default node version. Later installed the package jsreport-pdf-password and ran the code. Now there was no error in run time regarding any version missmatch.
As far as the package is conserned it requires node version 7 and anything above or below, the error in question occurs. I tried to even rebuild the package at a later version but it did not solve the issue. Thus i recommend not to use this package if your node version is greater than 7.

AWS Elasticbeanstalk Upgrade Issue Caused by lovell/sharp module

I'm trying to upgrade a live node application that resides in AWS Elastcibeanstalk from v8.12.0 to v10.13.0
and the only issue that I see is caused by sharp complaining about being built with a different version.
Here's the error:
Error: The module '/var/app/current/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
I can't upgrade our prod aws elb instances because of this issue.
Not sure what to do at this point..

Issues with using sqlite3 with electron on Mac OS

I am trying to include the sqlite3 package into my electron project. I I get this error:
have done postinstall. It runs correctly on nodejs.
node_modules/sqlite3/lib/binding/electron-v4.0-darwin-x64/node_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 69. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
I have the same issue with using sqlite on my developing app, The problem comes from Electron that's change the NODE_MODULE_VERSION to 69 refer to githup issue page to find more info https://github.com/electron/electron/pull/16687
I don't find a really working way to solve the problem for now just downgrade the electron and sqlite version to an older version should solve the problem and build the native module.

Node module works for electron but not for Mocha

I have a small development environment for electron with mocha tests. I installed the image-thumbnail library and I recompiled it for electron:
./node_modules/.bin/electron-rebuild
But when I run the tests with mocha I get the error:
Error: The module '/home/jose/Dev/JavaScripts/Electron/Ng6ETesting/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 59. Please try re-compiling or re-installing
I run npm rebuild and then it works for the test case but the app does not raise. The error now is:
Error: The module '/home/jose/Dev/JavaScripts/Electron/Ng6ETesting/node_modules/sharp/build/Release/sharp.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
Any help?
Thanks in advance.

Raspberry PI3 - Node version

My very first Raspberry and I want to install the Smart-mirror. When running npm start, it launch the home screen, but also coming with this error:
Error: The module '/home/pi/smart- mirror/node_modules/grpc/node/extension_binary/grpc_node.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 48. This version of Node.js requires NODE_MODULE_VERSION 51. Please try re-compiling or re-installing the module (for instance, using 'npm rebuild' or 'npm install')
I tried both, but ending up with the same error.
How do I fix it?

Resources