Repository navigation
On Windows ARM64 (Win32 ARM64), an error occurs during read and write operations #241
Copy link
Copy link
Open
Description
SerialPort Bindings Version
13.0.0
Node Version
v24.16.0
Electron Version
No response
Platform
windows ARM64
Architecture
ARM
Hardware or chipset of serialport
CH340 and FTDI
What steps will reproduce the bug?
- Connecting a USB-to-Serial Converter on Windows ARM64
- Run the test code:
npm run dev
src/index.ts
import { SerialPort } from 'serialport';
async function GetPortList() {
const ports = (await SerialPort.list()).filter(
port => !port.pnpId?.startsWith('BTHENUM')
);
console.log("Available ports: ", { prots: ports });
return ports;
}
async function test_read() {
let ports = await GetPortList();
if (ports.length === 0) {
console.log("No ports available");
return;
}
let port = new SerialPort({
path: ports[0].path,
baudRate: 115200
});
var count = 1;
port.on('data', (data: Buffer) => {
console.log(`Data received(${count}): `, data.toString());
count++;
if (count > 5) {
port.close();
}
});
port.write("Hello, Serial Port!", (err: any) => {
if (err) {
console.error("Error writing to port: ", err);
} else {
console.log("Message written to port");
}
});
console.log("Port opened: " + ports[0].path);
}
test_read().catch((err) => {
console.error("Error: ", err);
});package.json
{
"name": "test-bindings-cpp",
"scripts": {
"dev": "tsx src/index.ts"
},
"devDependencies": {
"@types/node": "^26.1.1",
"tsx": "^4.23.1",
"typescript": "^7.0.2"
},
"dependencies": {
"serialport": "^13.0.0",
"@serialport/bindings-cpp": "../bindings-cpp"
}
}What happens?
Consol error message:
$ npm run dev
npm notice run dev
npm notice run tsx src/index.ts
Available ports: {
prots:[
{
path:'COM8',
manufacturer: 'wch.cn',
serialNumber:'4824cB1D32&0&1,
pnpId: 'USB\\VID_1A86&PID_7523\\4&24CB1D32&0&1',
locationId: 'Port_#0001.Hub_#0001',
friendlyName: 'USB-SERIAL CH340 (COM8)',,
vendorId:'1A86
productId: '7523
}
]
}
Port opened: COM8
Error writing to port: [Error: Writing to COM port (GetoverlappedResult): Invalid handle]
node:events:487
throw er; // Unhandled 'error' event
^
Error: writing to COM port (GetoverlappedResult): Invalid handle
Emitted 'error' event on SerialPort instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorcloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Node.js v24.16.0
What should have happened?
It works fine on Windows x64:
$ npm run dev
npm warn Unknown user config "home". This will stop working in the next major version of npm.
> dev
> tsx src/index.ts
Available ports: {
prots: [
{
path: 'COM14',
manufacturer: 'wch.cn',
serialNumber: '7&332129A7&1&3',
pnpId: 'USB\\VID_1A86&PID_7523\\7&332129A7&1&3',
locationId: 'Port_#0003.Hub_#0006',
friendlyName: 'USB-SERIAL CH340 (COM14)',
vendorId: '1A86',
productId: '7523'
}
]
}
Port opened: COM14
Message written to port
Data received(1):
Data received(2):
Data received(3): a
Data received(4): a
Data received(5): a
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
littrick commentedon Jul 22, 2026
Please merge #242 or #238 to resolve this issue.
FloSch62 commentedon Aug 17, 2026
I would need the same.
littrick commentedon Aug 17, 2026
Hi, I've created a branch to fix it. Like that. Do you need it?
DragonWork commentedon Sep 25, 2026
You could try serialport-rs, my Rust-backed alternative with Windows ARM64 prebuilds. It avoids the affected C++ I/O code path, so it may resolve this issue.
littrick commentedon Sep 28, 2026
Thanks for the recommendation. I tried it briefly, and serialport-rs's serial port read/write does work.
However, compared with serialport, SerialPort.list() is missing a few fields, so for now I'm not considering migrating to serialport-rs.
I hope serialport-rs can become more complete and replace serialport, which is maintained and updated slowly.
DragonWork commentedon Sep 28, 2026
@littrick
Hey! That’s the kind of feedback I needed. Thanks! I was already partially working on it, and just released v0.5.0, which should cover the missing data in the
list()function on Windows and macOS.