Updating brew.sh for macOS is a fairly easy and trivial task (you can use my brewup script from here to make it even simpler), but sometimes things go south and the update process ends with a somewhat cryptic error like this:
==> Postinstalling node
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
brew doctor could help identify the culprit and it usually ends up being a Permission denied error – remember the time you tried to issue some commands related to brew / node / npm that began with the magical word
sudo ? Well, it turns out those files affected by it are now untouchable and that’s why brew fails to update.
To solve this permission denied error, issue the following in a terminal session:
sudo chown -R $(whoami):admin /usr/local/lib/node_modules/