Handle malformed package.json file.

Related to issue #1391.