After a review of npm commands and carefully going through all the directories that npm creates while installing packages I discovered how my package installations were messed up. Here are the steps that I used to fix the issues:
-
The crash was happening because the cordova binaries were in a folder that was not in the path.
-
Executing npm bin -g showed that the folder where the node packages were stored but this folder was not in the path. In my case it was in ~/.npm-global/bin
-
As soon as I added this to the path everything started working.
-
I decided to install version 4.2.0 of cordova based on a recommendation from [this]. (Error occurred trying to fall back to Cordova-lib execution)
It is still an unknown what folders does npm pick and why. Earlier installations were all in /usr/local When I re-installed, all the node package files were stored in my home directory under dot sub-folders.
I appreciate all the help from the folks that participated in this forum.