Node-serialport: port.close error: "asyncClose is not defined"

Created on 26 Jul 2019  路  4Comments  路  Source: serialport/node-serialport

Summary of Problem

While closing port using port.close() - error "asyncClose is not defined" is returned and port stays open.
What are possible reasons for this error?

  • I'm trying to close previously opened port
  • Error "asyncClose is not defined" is generated and port remains open
  • port should be closed

Versions, Operating System and Hardware

After tracing in debugger I realized that question "What are possible reasons for this error?" is rather rhetoric one. As SerialPort.close calls async function close() in win32.js this function returns asyncClose(fd) at line 63. I cannot find asyncClose() to be defined anywhere. Nevertheless super.close() at line 60 of win32.js makes port closed - I just cannot reopen it while receiving error "Access denied". Possibly I'm doing something not OK - I'll investigate more.

I checked everything I could. Port opens properly, I can read and write without any problems but when attempting to close it shows above mentioned error. Subsequently this port cannot be neither closed ("Port is not open") nor open ("Access denied").
It would be useful to have it working properly for the purpose of releasing the port and passing it to other application running on the same system - right now it's not possible.

bug resolution-verify

All 4 comments

Same issue here.

I've just published [email protected] give it a try. We'll get 8 out of beta yet.

Thanks. I'll try new version and let you know the results.

Issue is still present in 8.0.2. Think it's because the following is missing from the top of bindings/lib/win32.js:
const asyncClose = promisify(binding.close)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apiel picture apiel  路  5Comments

pghalliday picture pghalliday  路  4Comments

JBtje picture JBtje  路  8Comments

jdshin123 picture jdshin123  路  3Comments

reconbot picture reconbot  路  6Comments