Please use standard length of USB cable (preferably HP USB cable) to avoid any communication errors between printer and computer.
Try installing printer with another computer.
If error persists, it may be due to printer hardware issue and device would require service/repair.
You may also try using your device through the 10/100 ethernet network port available with this printer, which I believe should be working.