"So my Nexus 4 is rooted and unlocked. When I am trying to install Cyanogenmod Nightly, I cannot get my computer doesn't recognize my phone. I have the drivers installed. I have tried with USB debugging on and off and tried after a factory reset. I'm at a lost as to what I can do when computer can't recognize my phone."
I guess the above situation must have caused a lot of trouble for many Android users, as nothing can be read by your PC when computer doesn't recognize Android phone. You might have a hardware problem with your phone, your PC, or your cable. On the other hand, you might simply have the phone set wrong. The paragraphs below offer solutions which you could use to deal with such problems. The solution works for various Android devices such as Samsung, HTC, Motorola, Sony, running Adroid 6.0 M, Android 5.1/5.0 Lollipop, Android 4.4 KitKat, etc.
First, you have to make sure that the physical connection is working. When your Android phone is plugged in, look for a USB icon on the row of icons at the top of the phone's screen. If you cannot find your phone, you should:
With all these are done, you can then try to plug your USB devices in again.
Sometimes outdated system (most often Windows) will not recognize any Android device (or any USB device). And it's always a good idea to update your system. Remember not to install too many updates at the same time (not more than two or three), though.
When nothing works, debug mode DOES work most of the time. This is the mode intended for developers. It allows you to directly access your phone, transfer and install apps without notification. To activate debug mode, go to Settings > Developer options > and check USB debugging. Plug in your device. In the screenshots below, you can see the interface of Android Data Rcovery to learn how to activate debug mode.
Your micro USB hub in the phone can be damaged due to pin mis-contact or being constantly connected and disconnected due to a driver failure on your computer. To check if computer doesn't recognize Android phone because the USB hub is damaged, you can try another USB port, or you could try another computer.
To fix this problem, you can order one from eBay (a new USB hub costs only $7) and replace the old one with the newly bought.
If your Android device wasn't on the adb List, you can do the following changes to make it appear:
You can check your Android phone to see what caused your phone's connection problem and choose the most suitable solution.