Othiym23/environment defaults

Fixes npm/npm#6483.

/cc @iarna for review / knowledge-sharing @wilmoore because he identified this bug.