Upgrade Node Without Losing Global Packages (NVM + Yarn)

If you manage your Node versions with NVM and also prefer Yarn over NPM, you'll soon realize that when you install a new version of node, Yarn's references to your globally installed packages are lost.

The long road is to reinstall each of them, forcing yarn to re-link. A quicker solution is a nifty package called fix-yarn-global-packages. This accomplishes a couple things:

  • Locates all of your global packages in ~/.config/yarn/global/node_modules/.bin
  • Creates symlinks for each package to whatever is set for your yarn global bin
npm install -g fix-yarn-global-packages

Chore averted. Treat yourself. 🍺 🌮