We all know how “Stable” Front End technologies are.
Sometimes you need to work on different projects and switch your node
versions. Every time, when I change node version to the newer one using
n, I run into issues with running
grunt, gulp, webpack and
@angular/cli.
Here is an example.
Currently, I’m on version 7.8.0. When I go to global packages folder
(/usr/local/lib/node_modules) I see the following
picture:

Which is totally fine! Here I checked my node version (which is in fact 7.8.0) and verified that I don’t have any outdated packages.
However, let’s see what would happen if I change my node version to an old one (for example 0.10.28) and then switch it back to 7.8.0. Then I would verify outdated packages once again.

It turned out that I have an outdated npm and missing
@angular/cli package.
Conclusion
Every time you’re switching node versions:
- Navigate to the folder with the global packages
–
/usr/local/lib/node_modules(for Mac) - Run
sudo npm install -g npm@latest– to have the latest version of npm - Run
(sudo) npm updateto stay with the latestnpmand other dependencies