To completely remove Node.js from macOS (manual installation, not via Homebrew):

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

This command removes the Node binary, npm, all global packages in node_modules, and the associated man pages.

If you installed via Homebrew, use brew uninstall node instead.