I'm not sure how homebrew works but most of the node version managers will keep independent global installation folders for a version of node.
You could try using something like nvm which has a command to migrate your old global modules.
nvm install node --reinstall-packages-from=node
Are you talking about native modules that need to be rebuilt when the V8 version used by node is also upgraded?
Shouldn't nvm (node version manager) work? I rarely install node via any package manger, nvm provides some nice management features.
Re:Node v9.4.0
by apazzolini on Wednesday January 10, 2018 @12:23PM
(#16116835)
https://github.com/tj/n is also a good version manager for node.
--no-check-certificate for something that is intended to install software is unacceptable.
https://github.com/tj/n/pull/475/files
I guess nvm is better, needs some polishing, though (error prone for scripted usage, because of unpredictable exit > 0 behavior.
I tried nvm and it didn't even install correctly. I tried n just now and it works beautifully! thanks for the ref. Nice that it is from tj.
Maybe it's just me, but every upgrade corrupts the global node_modules.