heroku / heroku/heroku-buildpack-nodejs

Add descriptive warning for invalid JSON in package.json

Open
#464 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
1.3k
Forks
2.6k
Avg merge
1d 13h
Merged PRs (30d)
30

Description

Of the builds that fail to deploy on Heroku, between 5-10% of them fail because `package.json` is not valid JSON.

This error currently looks like this:

```
invalid-package-json git/master
❯ git push heroku master
Counting objects: 72, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (33/33), done.
Writing objects: 100% (72/72), 42.49 KiB | 0 bytes/s, done.
Total 72 (delta 31), reused 64 (delta 29)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: parse error: Expected separator between values at line 9, column 14
remote: ! Unable to parse package.json
remote:
remote:
remote: -----> Build failed
remote: parse error: Expected separator between values at line 9, column 14
remote: parse error: Expected separator between values at line 9, column 14
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to sheltered-hollows-52627.
remote:
To https://git.heroku.com/sheltered-hollows-52627.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sheltered-hollows-52627.git'
```

We can do much better than this.

Contributor guide

Open the contributing guide

Research direction

Start by locating the buildpack path that parses package.json and emits the error shown in the issue. Use the sample deployment output as the baseline, and consider the work complete when invalid JSON produces a clearer warning than the current generic parse failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.