Fix #3443: Object.keys error

When I have a module with a package.json that has no dependencies
specified and I do a `npm install {packagename}` there will be
an error thrown in the attempt to suppress a warning message
for global dependencies, which the package.json with no
dependencies does not have.