I was trying to instal Ionic framework in my Windows 8 system and was trying to install Cordova first.
I\'m getting this error while trying to install Cordova, that
I had this same problem when trying to upgrade pm2 to the latest version.
Thanks to sdm's answer I did npm update npm -g and it did the trick for me.
npm update npm -g