better error message for invalid package.json
fix not bubbling up error in resolveDirectory
better error reporting; handle index.js correctly