fixes #3566

`npm init && npm install --save "anyLibrary"` fails with error:

npm ERR! TypeError: Object.keys called on non-object
npm ERR!     at Function.keys (native)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/build.js:113:18

The line in question is:
```
      if (Object.keys(topPkg.dependencies).indexOf(currentPkg) === -1) {
```