node-serialport: Getting back 'true' for error when using serialport with electron
Operating System and Hardware: ubuntu 14.04 desktop
NodeJS Version: 4.4.0
Serialport version: 3.1.2
Python Version (if you’re having trouble building serialport): 2.7.6
(Run node -v && npm -v && python --version
to get the version numbers.)
Expected behavior
The port to open, or at minimum more useful error details
Actual behavior
Port doesn’t open, and I’m given an error of true
Steps and/or code to reproduce the issue
At first I was getting hit by the npm mismatch error. With the help of #538 I ran ../node-pre-gyp/bin/node-pre-gyp install --fallback-to-build --runtime=electron --target=1.1.0 --target_arch=x64 --update-binary --dist-url=https://atom.io/download/atom-shell
in my node_modules/serialport directory. This quickly cleared up this issue.
It should be noted that non-electron code works as expected on my machine 😦
Good, non-electron code: https://gist.github.com/jjshoe/79b161cd4abef34f23f13b4c79e73044 Bad, electron code: https://gist.github.com/jjshoe/86f99a8a7126c90f7c73db94cd1c7de0 Bad, electron code, output: https://gist.github.com/jjshoe/f9e25a1409001dd31214d0b2373f4b27
I tried to modify the C code to get better output, but C is way beyond my abilities. It would have been nice to see the raw data.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 37 (30 by maintainers)
I had similar problem with electron 1.2.1 and serialport 3.1.2 on OSX. The electron-rebuild command won’t rebuild serialport.
The work around I found is to patch electron-rebuild to invoke npm rebuild with --build-from-source option. After that, electron-rebuild -f seems to rebuild serialport and serialport can open port successfully.