Add some more error handling to main.js

Handles unmet dependencies.