Problem when sending a data with SerialPort (NodeJS).

Hi, I'm new to this, so I hope to be in the right section.
I have been testing SerialPort (NodeJS) and it works, to the exception of one thing, when sending, or writing a data through the serial port, it does not execute the order for which the Arduino is programmed, which in this case is to turn on an LED light, it works by sending the value it receives to turn off the LED, but when sending the data to turn on the LED, it does not work, I have tried to solve it, but I can not make it work, it works anyway when I turn off the LED, but when I turn it on, Ways I've tried, no.
Could you help me?

Please post the code using code tags

Sure, here it is:

const SerialPort = require('serialport');

const sport = new SerialPort('COM6', {
  baudRate: 9600,
  autoOpen: true


Arduino Code:

void setup(){
  pinMode(2, OUTPUT);
void loop(){
  char serialValue =;
  if(serialValue == '1') {
    digitalWrite(2, HIGH);
  if (serialValue == '0' ){
    digitalWrite(2, LOW);

(I just realized that sending the data 0 does not turn off the LED, but when sending any data, the LED goes off.)