Fail to upgrade to npm 5.4.0


I have upgraded to npm 5.4.0 this morning using : npm i -g npm
However, since then I can not run any npm command and keep getting error like these:

Is this a bug or something? And is it possible to downgrade to the previous version?


I’m no expert on node and npm but I do know you can get into quite a mess with it. As far as I’m aware I believe the best way is to use nvm (node version manager) this should also manage the npm version that will be used with node. So if you want to use the latest node version and npm version you can do
$ nvm install node
If you want to install a specific version you can use
$ nvm install 0.12
when these are installed you can switch between the different versions by the comand:
`$ nvm use 0.12
try nvm --help to get an idea of the different options.

It can get a bit tricky when working with different versions and installing modules just double check which version you are running at the time.