is the Pi attached to the internet? In your log I see npm ERR! code EHOSTUNREACH
This generally means you are not able to connect to the remote server to dawn load NR
Are you running Home Assistant or Docker?
either of these could be the problem
Has anyone successful got Node-Red to running on a Raspberry PI 5 with bookworm? It would be great to replicate their load sequence and instructions to do so. Thanks
From the log file npm ERR! request to https://registry.npmjs.org/node-red failed, reason: connect EHOSTUNREACH 2606:4700::6810:123:443
It is trying to use IPV6 addresses. Assuming that you have not got an IPV6 internet connection then that is not going to work. I suggest first following @zenofmud's advice, it is possible that the version of npm you installed has a problem. Installing it via the script may fix it.
In fact probably just uninstalling nodejs and npm and then running the script should be enough rather than starting from scratch.
Just to say that I have Node-RED running on a Pi 5 with Bookworm and I just flashed the SD with the system and then ran the standard install Node-RED command (bash ... etc)