Fix the environment used for the doc-build script.

Fixes #2004.
Fix bad variable reference in submodule.js.

In getSubmodules "args" was defined as "arg", which caused the following error:

```
npm ERR! ReferenceError: args is not defined
npm ERR!     at /usr/share/npm/lib/submodule.js:102:15
npm ERR!     at /usr/share/npm/node_modules/which/which.js:55:18
npm ERR!     at Object.oncomplete (fs.js:107:15)
```