Brew cleanup Error: Permission denied @ unlink_internal

This worked for me:

brew unlink node && brew link node

First fix permissions causing the error:

sudo chown -R "$(whoami)":admin /usr/local

On macOS Mojave, the chown command needs to be run on the specific directory, an example for the permissions issue in /usr/local/lib directory, this command would be

sudo chown -R "$(whoami)":admin /usr/local/lib

Then relink node with the --force option as directed:

brew link --overwrite node