Fix error logging for non-browser environments.

Two things:
1. `e` was changed to `error` because `e` doesn't exist.
2. We check the existence of actual method `appendChild`, not a proxy (if `document` exists). Because it is possible that we are in an environment with a `document` but still initialized by `Elm.worker`, which gives `{}` for `container`.