serialport / node-serialport

Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
https://serialport.io
MIT License
5.8k stars 1.01k forks source link

electron-serialport example is broken #2013

Closed gnesher closed 4 years ago

gnesher commented 4 years ago

📚 Documentation

The following repository - https://github.com/serialport/electron-serialport which is used to demonstrate the usage of electron-rebuild does not work.

When following instructions and running npm install you get the following error: 'electron-rebuild' is not recognized as an internal or external command,

I've circumvented this by running electron rebuild directly: ./node_modules/.bin/electron-rebuild -f -w yourmodule

No error is thrown, but when running the app (npm run start) I get the following error in the console:

Uncaught Error: The module '\?\C:\Users\gnesher\work\nortec\test2\node_modules\@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 70. This version of Node.js requires NODE_MODULE_VERSION 75. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).

I suspect there's a version mismatch between latest electron (v7) and a simple upgrade would solve the problem - but I've never used serialport or electron-rebuild so not sure

SebCanet commented 4 years ago

Hi, I have the same problem, example doesn't work, I updated everything an it seems not working anymore.

Uncaught (in promise) TypeError: SerialPort.list no longer takes a callback and only returns a promise at Function.SerialPort.list (K:\electron-serialport\node_modules\@serialport\stream\lib\index.js:651) at renderer.js:8

I cannot update my projects.

Thanks.

reconbot commented 4 years ago

That’s a different problem. You can no longer give serialport.list a callback. It returns a promise and you use that to list the ports.

SebCanet commented 4 years ago

Ok, but example still does not work :-D

reconbot commented 4 years ago

There are many many issues about electron and how to use electron rebuild. We have some guidance in our docs but since there are so many ways to build and package electron it’s hard to advise you in particular.

SebCanet commented 4 years ago

Many thanks for your answers. My problem is use serialport to communicate with Arduino board, and documente it to make it easy for anyone else. I use 'ncu' and last version of Electron, nodjs of course, like any newbie starting on it. But with a VM with nothing, starting from scratch and trying your example, it does not work. What can I do ?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.