Not sure whether something has changed in npm?
NodeJS 24 should be fine, but NodeJS have removed all the docs for how to install NodeJS system wide and are promoting tools like nvm as the default way to install, which means it's only installed for that single user, not system wide.
Darn it, that's going the same way as Python then. However, that isn't useful on a server, only on a workstation. Node-RED should be installed for a user, node.js should be installed system-wide.
Still, that shouldn't have caused the issue the OP saw.