question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while using this github action (ErrorEXError [JSONError]: Unexpected token)

See original GitHub issue

I am trying to use this action in my private repo but I run into an error like below during the execution of the workflow. The error is very long. Here I am providing the gist of it.

grafik

The end of the error is like so

ErrorEXError [JSONError]: Unexpected token } in JSON at position 142 while parsing near '...ear --port 8000",  },  "devDependencie...' in package.json
    at e.exports (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:82368)
    at parse (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:51821)
    at Function.e.exports.sync (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:51924)
    at Function.sync (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:83199)
    at Signale.get packageConfiguration [as packageConfiguration] (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:116193)
    at new Signale (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:115057)
    at Object.528 (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:88739)
    at __nccwpck_require__ (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:517248)
    at Object.5140 (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:1:142510)
    at __nccwpck_require__ (/home/runner/work/_actions/EndBug/add-and-commit/v9/lib/index.js:7:517248) {
  fileName: 'package.json'
}

Can you please let me know how to get this working? Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
martijnartscommented, Nov 3, 2022

@EndBug fwiw it looks like the action reads and validates a package.json in the workdir if there is one? My package.json was invalid (extra comma somewhere), fixing it stopped this bug from happening.

1reaction
mys2korcommented, Nov 3, 2022

@martijnarts I ended up adding the below code directly to my GitHub action

      - name: Commit created HTML & Push changes
        run: |
          apt-get update && apt-get install git
          git remote set-url origin "https://github.com/<repo you want the push to be done>"
          git config --global user.name "${{github.actor}}"
          git config --global user.email "${{github.actor}}@users.noreply.github.com"
          git add .
          git commit -m "<Commit message that we want>'"
          git push https://${{secrets.PAT}}@github.com/<repo you want the push to be done>

I my case, I use a Linux runner for this github actions. Also, I just create 1 file (that too in the action itself) and then I want to commit & push it so git add . works just fine. If you want to control precisely (add & commit a specific file for example), the nyou may want to tinker with the code above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Unexpected token i in JSON at position 1 #2567 - GitHub
Azure DevOps task fails with error Unexpected token i in JSON at position 1 even though GitVersion seems to complete successfully. Tried running ......
Read more >
Errors of Unexpected token in JSON at position XXX while ...
I npm install on a directory with a package.json for my company project. However, it keeps giving me various errors of Unexpected token...
Read more >
Unexpected token < in JSON at position 0 - Dave Ceddia
Read on for a quick suggestion, and watch the video for a walkthrough of a few techniques you ... How to fix Unexpected...
Read more >
“syntax error unexpected end of json input pareserror” Code ...
Open Windows Powershell as admin npm cache clean --force solved the problem for me Alternative : You can use yarn instead npm install...
Read more >
JSONError: Unexpected token '<' at 1:1 <!DOCTYPE html>
I have an endpoint, that by design is returning text/html formatted code. I have my test in postman setup with the requisite Accept...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found