Error message while programming arduino nano

I was uploading a compiled code to arduino nano (328) while this error showed up
Arduino: 1.6.8 (Windows 10), Board: "Arduino Nano, ATmega328"

Sketch uses 1,066 bytes (3%) of program storage space. Maximum is 30,720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "\.\COM5": Access is denied.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xf4
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xf4
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Its mentioned in the error itself, choose the right board

Access denied when trying to use a COM port typically indicates that another application is using the port. Could this be happening? It's possible to get multiple instances of the IDE running, such that a serial monitor in the background is screwing it up, or if you're using 1.6.8 on windows, it handles serial ports wrong and can get access denied (it also repeatedly resets Arduino's connected to the system if the serial monitor isn't open) - use 1.6.5r5 or 1.6.9. And of course, a third party program unrelated to Arduino could be trying to grab the port. You occasionally see references here to programs that assume any serial port is "their" device and try to use it (for example, they think it's a modem and try to send modem commands to it).

Missed this part, when browsing from my mobile :slight_smile:

avrdude: ser_open(): can't open device "\.\COM5": Access is denied.

As DrAzzy said some other program is trying to use the port.

You can try switching to a different USB port or close any other app.