user58338: I am testing a project on Arduino Nano. I copy-paste the code on the Arduino IDE and click "Upload". I see:
No device found on cu.usbserial-<unique id>
An error occurred while uploading the sketch

The computer sees the board: when I disconnect the board from the USB socket, the list of ports in Tools > Port no longer shows this port.
The error thing happens:

if I press the reset button first, then click "Upload"
if I change the USB cable (I tried 5 different ones, one of which worked a few years ago, the last time I used this same board)
if I use a simple blink code
if I connect to a different USB port
if I upgrade the Arduino IDE to the latest software from arduino.cc .

The Get board info command shows that the computer can read the VID and the PID, but not the serial number or the board type. If I connect an Arduino Uno to the same socket, I can see the serial number and the board type, but I get the same error message (just with a different port ID). Neither boards show signs of degradation.
The Boards Manager shows that the Arduino AVR Boards, which include Arduino Uno and Arduino Nano, are installed.
When I click "Upload", the IDE compiles the program, then the Nano's L LED blinks, then the TX blinks, then a pause, then the L, then the RX, then the L, then the RX, and then the IDE shows the error. So I suspect that the error is not what the IDE says.
Furthermore, the connection between the Arduino and the IDE is working because the Serial Monitor shows the output of the previous program (at 9600 baud).
Some Arduinos can reset by connecting RX to GROUND and uploading code, but this one does not have an RX pin.
How can I debug this error?

user58338: It seems that everything is working as it should and the computer and the board can see each other. The only thing left to do is to select the board type so the IDE knows how to send the code in a way that the board can interpret.
Select Tools > Board > Arduino AVR Boards > Arduino Nano.
If you have an old or non-Arduino board, try the old bootloader in the processor, as in  CH340 Nano avrdude: stk500_getsync() not in sync resp=0xa4 .

58338: <p>I am testing a project on Arduino Nano. I copy-paste the code on the Arduino IDE and click &quot;Upload&quot;. I see:</p>
<pre><code>No device found on cu.usbserial-&lt;unique id&gt;
An error occurred while uploading the sketch
</code></pre>
<p>The computer sees the board: when I disconnect the board from the USB socket, the list of ports in <code>Tools &gt; Port</code> no longer shows this port.</p>
<p>The error thing happens:</p>
<ul>
<li>if I press the reset button first, then click &quot;Upload&quot;</li>
<li>if I change the USB cable (I tried 5 different ones, one of which worked a few years ago, the last time I used this same board)</li>
<li>if I use a <a href="https://arduino-tutorials.net/tutorial/blinking-led-on-arduino" rel="nofollow noreferrer">simple blink code</a></li>
<li>if I connect to a different USB port</li>
<li>if I upgrade the Arduino IDE to the latest software from arduino.cc .</li>
</ul>
<p>The <code>Get board info</code> command shows that the computer can read the VID and the PID, but not the serial number or the board type. If I connect an Arduino Uno to the same socket, I can see the serial number and the board type, but I get the same error message (just with a different port ID). Neither boards show signs of degradation.</p>
<p>The Boards Manager shows that the Arduino AVR Boards, which include Arduino Uno and Arduino Nano, are installed.</p>
<p>When I click &quot;Upload&quot;, the IDE compiles the program, then the Nano's L LED blinks, then the TX blinks, then a pause, then the L, then the RX, then the L, then the RX, and then the IDE shows the error. So I suspect that the error is not what the IDE says.</p>
<p>Furthermore, the connection between the Arduino and the IDE is working because the Serial Monitor shows the output of the previous program (at 9600 baud).</p>
<p>Some Arduinos can reset by connecting RX to GROUND and uploading code, but this one does not have an RX pin.</p>
<p>How can I debug this error?</p>
 58338: <p>It seems that everything is working as it should and the computer and the board can see each other. The only thing left to do is to select the board type so the IDE knows how to send the code in a way that the board can interpret.</p>
<p>Select <code>Tools &gt; Board &gt; Arduino AVR Boards &gt; Arduino Nano</code>.</p>
<p>If you have an old or non-Arduino board, try the old bootloader in the processor, as in  <a href="https://arduino.stackexchange.com/questions/51729/ch340-nano-avrdude-stk500-getsync-not-in-sync-resp-0xa4">CH340 Nano avrdude: stk500_getsync() not in sync resp=0xa4</a> .</p>
