HauPham
HauPham

Reputation: 95

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:

  1. git init, add and commit my app's source code.
  2. heroku create to create Heroku remote repo for my app.
  3. git push heroku master to push my app's source code to heroku
  4. 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=*

Image taken from that error

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!

Upvotes: 3

Views: 3382

Answers (5)

mdmostafa
mdmostafa

Reputation: 852

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.

Upvotes: 1

Sujal Singh
Sujal Singh

Reputation: 582

I tried reinstalling but didn't work, just add curly braces in the config.json file.

{
    
}

Works perfectly now.

Upvotes: 1

LittletonDoug
LittletonDoug

Reputation: 81

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
}

Upvotes: 5

Adam McCrea
Adam McCrea

Reputation: 1112

Your config.json contains invalid JSON (note the two closing brackets). Reinstall the Heroku CLI, and you should be in good shape.

Upvotes: 2

Vaibhav
Vaibhav

Reputation: 1499

    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

Upvotes: 0

Related Questions