dojo not defined is the error you get when the api fails to load
You could load one locally, but my guess is that is not your problem
If it loads occasionally, then it sounds like your app is configured properly. Are you behind a corporate firewall or running antivirus (particularly I have seen issues with Kaspersky). I would rule those networking type issues out before you commit to bringing the API local