node-serialport: I cannot install serialport NODE_MODULE_VERSION error.
Hi! I wanted to install and use serialport to use an arduino with NodeJS and electron. But after a lot of try, I cannot install serialport. After many issues, I have this issue and i find nothing to resolve it. I tried to use electron-rebuild but without success. I use nodejs version 14.17, and I’m on windows 10. Thanks a lot for your help !
D:\Developpement\UFC\node_modules\@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 17 (9 by maintainers)
I think that I might need to tweak the electron installation instructions a little, to recommend the use of electron rebuild rather than suggesting it as optional.
In referring to the electron docs, their immediate solution is to use electron-rebuild, and this is exactly what we use in the electron-serialport example. This way the installation uses your version of electron rather than your version of node for the package installation. To do this they suggest:
A quick way to check if this would work for you would be to try the electron-serailport example, the instructions can be found here. To handle the install -> rebuild we simply add it into the package scripts
There are some alternative instructions which would change your npm environment variables, but that would make it messy if you have multiple packages, some of which don’t use electron, and it means that any one else who wants to use your project would need to change the config.
@seriouz would you be able to check if electron-rebuild works for you, and if so I’ll update the docs for electron to clarify this
Executing
.\node_modules\.bin\electron-rebuild.cmd
did the trick! Thank you 😃 Edit: I did it on my project and not your example one.