Cordova or NPM Update Errors – MODULE_NOT_FOUND / EACCES

If you’re taking a break and updating node, npm, cordova or other various packages – you may run into some permission issues causing errors like MODULE_NOT_FOUND or EACCES. Below are some errors I experienced (in OSX 10.11).

These errors were fixed pretty easily by running the below:

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

This command was originally found at:
https://docs.npmjs.com/getting-started/fixing-npm-permissions

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update" "-g" "cordova"
npm ERR! node v5.7.0
npm ERR! npm v3.6.0
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'github-url-from-git'

OR:

npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/.staging'

Hope this info helps out someone having the same issues.

Cordova or NPM Update Errors – MODULE_NOT_FOUND / EACCES