'Syntax error when start $ heroku open
I am new to Heroku and I am trying to deploy my first app onto Heroku. I followed instruction, which were:
- git init, add and commit my app's source code.
- heroku create to create Heroku remote repo for my app.
- git push heroku master to push my app's source code to heroku
- heroku open
Problem happened when I tried to run heroku open, which was:
$ heroku open
(node:6192) SyntaxError Plugin:
heroku:C:\Users\hauph\AppData\Local\heroku\conf
ig.json: Unexpected string in JSON at position 72 module:
@oclif/[email protected]
task: runHook prerun
plugin: heroku
root: C:\Program Files\heroku\client
See more details with DEBUG=*
I checked file config.json at the direction as addressed above, and it was:
{
"schema": 1,
"install": "554c101b-d4de-496c-9768-710142ebfb20"
}
"skipAnalytics": false
}
So what did I do wrong here?
I would be grateful for any help.
Thank you very much!
Solution 1:[1]
Your config.json contains invalid JSON (note the two closing brackets). Reinstall the Heroku CLI, and you should be in good shape.
Solution 2:[2]
I had the same problem. Not sure why it ends up corrupted, but the config.json should look like the following (get rid of the curly brace before skipAnalytics):
{
"schema": 1,
"install": "3265b92a-27f4-4adb-9c07-75d9213f0000",
"skipAnalytics": false
}
Solution 3:[3]
I tried reinstalling but didn't work, just add curly braces in the config.json file.
{
}
Works perfectly now.
Solution 4:[4]
I had the same error when I tried to build on heroku as like below
(node:1179857) SyntaxError Plugin: heroku: /home/{...}/.local/share/heroku/config.json: Unexpected end of JSON input
module: @oclif/[email protected]
task: runHook prerun
plugin: heroku
root: /snap/heroku/4085
See more details with DEBUG=*
set git remote heroku to https://git.heroku.com/{...}.git
So I opened the config.json file from this path /home/{...}/.local/share/heroku/config.json and added blank curly braces
{
}
Then I run the command heroku git:remote -a {your project name} to set heroku git remote
Finally checked the config.json file and added valid json value automatically like this screenshot:
{
"schema": 1,
"install": "19975845-fr45-hfgt6-iu78-c27hgy243c46d",
"skipAnalytics": false
}
Finally set remote successfully. I hope it will make developers easier to deploy on heroku if this type of error comes.
Solution 5:[5]
USAGE
$ heroku apps:open [PATH]
OPTIONS
-a, --app=app (required) app to run command against
-r, --remote=remote git remote of app to use
EXAMPLES
$ heroku open -a myapp
# opens https://myapp.herokuapp.com
$ heroku open -a myapp /foo
# opens https://myapp.herokuapp.com/foo
Please visit heroku cli commands documentation here https://devcenter.heroku.com/articles/heroku-cli-commands
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adam McCrea |
| Solution 2 | LittletonDoug |
| Solution 3 | Sujal Singh |
| Solution 4 | |
| Solution 5 | Vaibhav Kumar Goyal |
