Node Version Manager (
nvm) is a tool I use on a daily basis. Lately, we have upgraded some projects to newer Node versions and this is causing some problems.
My global packages (like
cdk) were installed when I was still running version 16. Now I'm running version 18 and those packages are not globally available anymore.
The same can happen when running
nvm install upgrades Node to a new minor or patch version.
Next time this happens to you, follow these steps:
nvm listto find the previously installed version, the one that "contains" the global packages
nvm reinstall-packages <previousVersion>to get your global packages back.
If you want to get a list of all globally installed packages, run
npm list -g --depth 0.