Using node.js, I wanted to create a kiosk application with a RFID Reader attached to the kiosk. In order to access my RFID Reader, I installed the node-hid library (https://github.com/node-hid/node-hid). However, when I tried to run the application, an error occured, says:
Uncaught Exception
Error: The module 'D:\Projects\Electron\SelfService\node_modules\node-hid...\build\HID.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js required NODE_MODULE_VERSION 73.
I already updated the library and the node.js version to the latest update, but since the library is kinda old, it doesn't get any more update.
I tried to downgrade the node version, however there aren't any helpful tutorial I can find out there. I know there are many tutorial that explained how to install the older version of node, but I can't simply know what version of node I need from the error message displayed above.
I need to get the device readable by the application. If somehow, it's impossible to use the node-hid library, what is the latest library you recommended to access the RFID Reader from the application?
Note: I'm familiar with web development, including Javascript language, but Node.js is a new experience for me. I'll try my best to provide informations regarding my project, but if there are some mistakes with how I described my problem or if I have some difficulties in understanding your answers, please bear with me.
EDIT: I forgot to mention I'm on Windows 10, the node version I installed is 10.16.3
First Try this command -
Uninstall the electron first then try below command
sudo npm install --save-dev electron#4.0.0
sudo npm i --save-dev electron-releases#4.0.0
And also try to update chrome
Above is solution be sure minimum using Linux 16.04 with x64 processor and for npm version change see below
For NPM Version Downgrade of Linux/Ubuntu
sudo npm install -g npm#version
example-
sudo npm install -g npm#6.9
For Windows - start command prompt administrator
npm install -g npm#version
example-
npm install -g npm#6.9
You can uninstall the current node and then re-install the desired node version.
But the best practice will be installing node.js using the nvm aka node version manager.
Using nvm you can easily switch between different node version as well as different npm version.
Here's a quick start for installing node using nvm in both
windows, linux and unix platform.
NVM Official doc for unix and linux.
NVM alternative for windows
I am new to Node Webkit, so I might not entirely understand how NodeJS and Node Webkit is connected.
I am trying to get the serialport plugin work in Node Webkit. I get this error when trying to require("serialport");:
serialport.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module...
I've tried recompiling and all that - doesn't work. So I would rather just downgrade to a node version that fits. Problem is that if I type node -v in my terminal I get v6.10.1, which according to this should be NODE_MODULE_VERSION 48.
So I am confused when the error tells me that it is using 57. Does Node Webkit use another NodeJS version than the one installed on my computer?
Here are the Node Webkit release notes:
Update Node.js to v8.6.0
https://nwjs.io/blog/v0.25.4/
Node Webkit requires v8.6.0 and you have installed v6.10.1. The serialport module according to this can be used with Node >= v4.x.x. Upgrade node on your local system and try again.
Maybe a npm install is needed? You tried that?
I know that these are some similar / duplicate responses when searching for a solution to this. But the Node world seems to update so regularly that any answers I've found are refering to a much older version.
I'm currently running:
Node v6.9.1
Node Inspector v0.12.8
The error I get is as follows:
Detached from the target
Remote debuggng has been terminated with reason: websocket_closed
please re-attach to the new target
I had an identical issue. After digging around on some forums, I found that downgrading to Node v6.3.1. Here
So the next question was "How do I manage versions of node". Plenty of results show up with nvm. Stack Overflow has a post on it here.
None of the version managers for windows are kept up with. I found another one that is kept up to date (as of 1/1/17). I posted that answer here
Back to the original problem, with the nvm-windows installed:
nvm install v6.3.1 //I was running 6.9.1 - downgrade
The utility downgrades your npm version
Downloading npm version 3.10.3....complete
Installing npm v3.10.3
Then use it
nvm use 6.3.1
Note - I use a bunch of IDEs / Editors (depending on what I am doing). Editors such as Atom or WebStorm which have a Terminal / Command prompt embeded in it will need to be restarted AFTER you install nvm-windows in order to get access to the environment command "nvm".
Once you have node downgraded, the node-inspector worked find for me:
node-debug server.js
Maybe node with higher version(6.9.1) built in inspect, and node-inspect don't update longer..
solution:use node --inspect yourapp replace node-inspect & node --debug yourapp
It worked for me.
you can see Github issues Detached from the target, websocket_closed, cannot read property ref of undefined (NM[0] is undefined)
I am starting to learn Nodejs and tried to install it.
Now, when I do node -v I get v4.4.4 and when I do nodejs -v, I get v0.10.45
which node gives /usr/local/bin/node, which nodejs gives /usr/bin/nodejs
I need v4.4.4. Because of those different results I am not sure to start.
What can I do?
I recommend installing NVM (node version manager). It makes dealing with multiple node version installations really nice. Digital Ocean has a good tutorial on doing that here:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
Once you've installed NVM you can likely remove your other node versions and all of your programs that use node will default to whatever version you set as the default with nvm.
I try to use node-vlc with nw.js (v0.12.0-alpha2). When i launch my app without nw.js it works, but when i launch it with nw.js i got an error:
Uncaught Error: Module did not self-register.", source: /home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js (84)
I tried some commands with nw-gyp but it couldn't help me.
I am on Ubuntu 14, 64-bit.
If you've upgraded node then npm rebuild might fix this for you
For me:
rm -r node_modules then
npm install
I had a similar issue with another product and my fix was to change the version of node I was using. I was using 0.12.0 and changed back to 0.10.26.
Personally, I use NVM to handle node version changing. With NVM installed it's as simple as running
nvm use 0.10.26
Or setting the default version to 0.10.26
nvm alias default 0.10.26
Hopefully this helps you out - our issues came from different products but the solution may be the same.
I had similar problem.
/Users/user/NodeAddons/bridge/node_modules/bindings/bindings.js:83
Error: Module did not self-register.
In my case I was doing a C/C++ Add-on, and I had forgotten to export the add-on, in my main.cc was missing the code below:
void Init(v8::Handle<v8::Object> exports) {
NODE_SET_METHOD(exports, "method", method);
}
NODE_MODULE(method, Init);
Hope this helps others!
Thanks :)
I've add the same issue because I installed to modules as sudo...
Removing the node modules folder and reinstalling as normal user fixed it.
For me npm rebuild or npm update didn't work. I had to remove the node_modules folder and run npm install to install them again.
I once had this problem when creating a multi-file c++ addon. In my binding.gyp file I had:
"sources": ["src/*.cc", "src/*.h" ]
And my project contained several *.cc files. However, the NODE_MODULE() macro was called only on one file which imported the rest of the files. But node expects that it is called on the frist *.cc file listed in sources. So I had to change sources to explicitly add that file to the beginning
For me, running npm update worked
I was getting an internal error: Module did not self-register.
Deleted the node_modules folder
ran npm install
It worked just fine.
I had this error with Snappy. Was using Node 11. Checked Snappy's NPM page https://www.npmjs.com/package/snappy where they listed which versions of node they supported.
Deleting node_modules folder rm -rf node_modules and then reinstalling using the correct version of Node resolved it.
One of the versions they supported on Linux at the time of this writing was Node version 12.
nvm deactivate 11
nvm uninstall 11
nvm install 12
nvm use 12
Problem solved
Another cause of this problem: if you're using pm2, then after upgrading node you may need to reinstall pm2. Test whether pm2 is the issue by running your app
without pm2 node server.js
then with pm2: pm2 start server.js.
Proper way to update PM2 after updating Node.js
I had this same issue with 0.12 and io.js 1.3.0, reverting to Node.js 0.10 fixed the issue.
Rebuild your C++ add-ons.
Did you encounter something like this?
Module did not self-register: '…\node_modules\#u4\opencv4nodejs\build\Release\opencv4nodejs.node
It’s likely that you have just updated your Node.js. Once you updated your Node.js, you need to rebuild your C++ add-ons, Node.js packages written in C++.
Why
When you build Node.js’ C++ add-ons, they get compiled into require-able .node files and linked to the currently installed Node.js ABI library, which is not compatible with other versions of it. Your packages were built only compatible with the specific version of Node.js.
How
Firstly, try npm rebuild. If your C++-add-on-based packages have a build script, it’ll do. If it doesn’t, you need to manually build your C++ native add-on packages. Do again what you did when you were installing such packages. Refer to the building instructions in the packages’ documentations to rebuild them. Or try reinstalling (npm install) them.
I had the same problem. My script that was referencing a global reference script had an invalid reference. I took off that invalid reference and the error was gone. My error message had no indication of that particular invalid reference which made it harder to debug. But 'Uncaught Error: Module did not self-register' was the message I was getting.
This also happen in my other project. For some reason, it wouldn't recognize the reference path if one of the characters are uppercase. Even thought, the upper-casing was the correct spelling of the path.
I had this issue while setting up my Cypress project.
I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', to tell cypress explicitly to use the node version installed on my machine.
Add this line to your settings file:
**"nodeVersion": "system"**