title: Error: Open (GetCommState) : Unknown error code 1 - Nodejs, express, SerialPort
body: <p>I am trying to connect a fiscal printer that has serial input to nodejs. I'm using the SerialPort module, but I can't make the connection, since the console gives me the following error: &quot;Error: Open (GetCommState): Unknow error code 1&quot;. I would like to know if you could help me with this error, or tell me where I can find the meaning of each of the errors, since I do not know what the error code 1 means</p>
  <pre><code>  const SerialPort = require(&quot;serialport&quot;)
    const Readline = SerialPort.parsers.Readline
    const parser = new Readline
    const mySerial = new SerialPort('COM2', {
       baudRate: 9600
     })
     mySerial.on('open', () =&gt; {
       console.log(&quot;Port COM2&quot;)
     })
  </code></pre>
  <p>The error:</p>
  <p><a href="https://i.stack.imgur.com/7y0fW.png" rel="nofollow noreferrer">ERROR: OPEN (GETCOMMSTATE: UNKNOWN ERROR CODE 1</a></p>