If you are getting this error is due to the device is not being properly detected, installed or authorised.
Run the ADB command below to check the device properties and check if it’s properly detected. If not you must reinstall the device drivers. (Check related article about ADB commands)
adb shell getprop