Don't check against the window to detect node.js, wrap code in a try catch statement
and have it degrade gracefully.

Fixes #147