Issue #1391: Handle malformed package.json file

Signed-off-by: Anton Kovalyov <anton@kovalyov.net>