Skip to content
Advertisement

npm outdated -g Error ‘Cannot read property ‘length’ of undefined’

I am trying to determine the version status of my npm installed global packages. After running the npm outdated -g --depth=0 in the terminal I receive this error:

JavaScript

Contents of /Users/dangranger/.npm/_logs/2019-03-14T21_58_37_962Z-debug.log

JavaScript

Can anyone help resolve this issue for me?

Thanks

Advertisement

Answer

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.

Advertisement