avrdude: stk500_recv(): programmer is not responding

Hi, so I'm a beginner at using arduino, and I wonder why sometimes I can't upload to the arduino.
Here is the error code:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfd
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xfd

I realized that this happens when an ultrasonic sensor is being plugged or anything that requires a certain voltage is plugged into the arduino. Is it a normal thing that I should always unplug the voltage wire before uploading it?

Are you connecting circuitry to pins 0 and 1? Those pins are used for communication with the computer, so connecting anything to them can interfere with uploads.

No actually, I only used the 3.3V, 5V, GND, 2, 3, and 11.
So if I used a USB hub, I am not able to connect anything with voltages.
If I connect directly to my Laptop, then I am only able to use only one of the voltages pin.

So... is this normal? I tried to actually plug in a power supply together with the USB but it does not seem to be effective.

Sometimes this also comes out: avrdude: ser_open(): can't open device "\.\COM6": Access is denied.