npm outdated -g Error 'Cannot read property 'length' of undefined'

If you do not want to go through the bother of uninstalling and reinstalling Node, you can manually edit the "lib/outdated.js" file located in the "npm/node_modules/npm" path with the patch from the npm Github site at npm "outdated -g" patch

The fix is as simple as adding "|| 'global'" to one line. Works fine and will stay in place until the next npm update.


If the ||'global' does not work, try these, it's what worked for me:

Open your cmd and Go to your root User folder such as C:\Users\User and run npm install -g npm@latest

this will update your npm to the latest version. Try your install again and should work fine now.

Additionally, you can use npm audit fix after the npm install -g npm@latest

Tags:

Javascript

Npm