-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node Serialport crashes #4622
Comments
+1 |
It crashes with SIGSEGV when doing something like this: import { SerialPort } from "serialport";
const sp = new SerialPort({
path: "/dev/ttyUSB0",
baudRate: 9600,
autoOpen: true,
}); output: EDIT: using serialport version 12.0.0 (works with node on version 20) |
* Fixes oven-sh#4622 * cleanup --------- Co-authored-by: Jarred Sumner <[email protected]>
This works for me in Bun
import { autoDetect } from "@serialport/bindings-cpp"
const Binding = autoDetect()
console.log(await Binding.list())
// see a list correctly But this doesn't (
import { SerialPort } from 'serialport'
const serial = new SerialPort({ path: '/dev/ttyACM0', baudRate: 115200, autoOpen: false })
serial.open((err) => console.log(err || 'success')) Error shows as follows:
Is this related to |
Interested in this |
I've tried this but it didn't work for me when running the script with @Jarred-Sumner in #5452 you mention "serialport no longer crashes" but it does, the same reproduction applies. It might be worth mentioning that I'm running this on modern MBPs, I haven't checked whether Linux / Windows would run. Thanks for looking into it so far! |
Got no luck too |
Bun is just quitting on me using the latest win 11 build. |
Hey @Jarred-Sumner - not to be entitled to a fix here but to understand where it stands: how does an issue like this rank on the priorities? Bun / Oven has a lot going on but according to the pinned priorities and docs an incompatibility with Node would be pretty high up. "drop in replacement" is mentioned many times on the website/docs. So, that said, are we waiting for someone from the community to send in a PR or is the Bun team itself actively trying to close that gap? Because if it's the former I don't see how the stated goal is attainable, if it's the latter I don't understand why an issue like this is left to flounder. Taking this issue as an example; I am invested enough to burn some time testing it out and providing feedback but if it doesn't work it's really not worth my time diving deep to fix a niche case to save myself a few seconds on a side-project. And if the "new shiny thing" doesn't work in that context I'm really not likely to spend my paid time on it either (where, granted, it might work because it's more standard use, but hitting this wall there will be much more painful). IMO not providing clarity here really hampers the potential adoption. So, TLDR; is this issue likely to get more attention any time soon or should I just let it go? |
Do you have any updates on this? I'm trying to use bun for a typescript project that works with some mechanical displays and all my code works except for the serial port library crashes it. |
Nope. I stopped tracking whether this might be fixed passively and am not trying to fix it actively (see above). |
debugger brought me to |
interested in this |
I ended up using Python. It just works. And with UV the setup for venv is pretty easy. |
Hard solution, you can just rely on using nodejs 🤣 |
yeah... I immediately missed Bun. Bun is a great package management tool, I should have just kept in JS world and used both Node and Bun but oh well. It's a 50 line server so maybe one day I'll rewrite it. |
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983 (congrats btw!)
What platform is your computer?
Darwin 21.6.0 arm64 arm
What steps can reproduce the bug?
Reproduction here
bun install @serialport/bindings-cpp
This crashes with:
What is the expected behavior?
The Node Serialport packages work as expected, the list command lists available serial ports etc.
What do you see instead?
Crash:
Additional information
This package is the low-level interface for Node Serialport so I expect if this works the whole thing should. I suspect this issue has something to do with
napi
usage but I have 0 experience in this area.The text was updated successfully, but these errors were encountered: