Just doing a search for that error it looks like it is probably a problem with your .git/index. You should be able to fix the “bad index” issue by running:
cd ~/MagicMirror rm -rf .git/index git resetYou may want to make a backup of your config.js file just in case it does anything weird. I’m not sure if that will solve your module problem. It should allow you to pull the latest MagicMirror version though.