Moved serialport to optionalDependencies and added handling code.