Fix read-installed options

Options were ignored, and `opts.depth` can be zero.

Comment about the second commit:
The default value of `depth` config is `Infinity` and lifecycle.js was writing its value with `JSON.stringify`. Since `JSON.stringify(Infinity)` is `"null"`, `npm_config_depth` env was set to `"null"`, read as 0 within child process. This led `depth` to be 0 in unit tests.