title: Declaring a new SerialPort as a variable doesn't allow me to read data? SerialPort node js
body: <h2>What am I trying to do?</h2>
  <p>For my electron project I am trying to declare my port as a variable so that the path can be changed by the user if necessary. (Need this functionality)</p>
  <p>I did see the port.update() function in the documentation but I couldn't get it working for updating the path. Just trying to figure out a way of dynamically updating the port path while still be able to receive incoming data.</p>
  <h2>What's my problem?</h2>
  <p>I have a parser that listens for incoming data from the micro-controller but when I declare the port as a variable it doesn't receive any incoming data. If I declare the port as a constant, the parser is able to read incoming data no problem.</p>
  <h2>Code</h2>
  <h3>Declaring as variable</h3>
  <pre><code>// where arg is the com specified by the user, I tried it with COM4 but still doesn't work
  var port = new SerialPort(arg, {
      baudRate: 115200,
      autoOpen:false
  })
  </code></pre>
  <h3>Declaring as constant</h3>
  <pre><code>const port = new SerialPort(&quot;COM4&quot;,{
      autoOpen:false,
      baudRate:115200
  });
  </code></pre>
  <h3>Parser listener</h3>
  <pre><code>const Readline = SerialPort.parsers.Readline;
  const parse = port.pipe(new Readline({ delimiter: '\r\n' }));
  parse.on('data',function(data){console.log(data)})
  </code></pre>
  <h3>console output for port declared as variable</h3>
  <pre><code>is port open =&gt; true
  message written
  </code></pre>
  <h3>console output for port declared as const</h3>
  <pre><code>is port open =&gt; true
  message written
  Hello from Micro-controller
  </code></pre>