Skip to content

[BUG] Unhandled Rejection at: Promise { SyntaxError: JSON5: invalid character '(' at 1:94 #980

Closed

Description

@javierecr

I'm trying to run compodoc on my Angular 9 project and it keep throwing an error

Angular: 9.0.2
NPM: 12.14.0
Compodoc: 1.11.1
Typescript: 3.7.5

Im running npx compodoc -p tsconfig.json. Here's the error:

Unhandled Rejection at: Promise {
  <rejected> SyntaxError: JSON5: invalid character '(' at 1:94
      at syntaxError (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:1083:17)
      at invalidChar (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:1028:12)
      at Object.value (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:287:15)
      at lex (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:78:42)
      at Object.parse (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:25:17)
      at loopInsideModule (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5370:52)
      at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5403:29)
      at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21)
      at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21)
      at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21) {
    lineNumber: 1,
    columnNumber: 94
  }
} reason: SyntaxError: JSON5: invalid character '(' at 1:94
    at syntaxError (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:1083:17)
    at invalidChar (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:1028:12)
    at Object.value (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:287:15)
    at lex (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:78:42)
    at Object.parse (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/node_modules/json5/lib/parse.js:25:17)
    at loopInsideModule (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5370:52)
    at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5403:29)
    at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21)
    at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21)
    at loopRoutesParser (/Users/javier/Documents/dev/jaque/plato-puesto/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5408:21) {
  lineNumber: 1,
  columnNumber: 94
}```

Activity

  1. BrsJsk commented on Aug 18, 2020

    @BrsJsk

    I'm having the same issue..

  2. BrsJsk commented on Aug 18, 2020

    @BrsJsk

    If you add
    --disableDependencies --minimal arguments, it should pass.

  3. changed the title [-]Unhandled Rejection at: Promise { SyntaxError: JSON5: invalid character '(' at 1:94[/-] [+][BUG] Unhandled Rejection at: Promise { SyntaxError: JSON5: invalid character '(' at 1:94[/+] on Oct 16, 2020
  4. vogloblinsky commented on Oct 16, 2020

    @vogloblinsky
    Contributor

    Can i have the source code of the file before this error.

  5. stale commented on Dec 16, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  6. stale commented on Dec 24, 2020

    @stale

    This issue has been automatically closed because it has not had recent activity. Please file a new issue if you are encountering a similar or related problem. Thank you for your contributions.

  7. jgomesmv commented on Jul 28, 2021

    @jgomesmv

    This issue is still happening on version 1.1.14. In minimal mode as @BrsJsk mentioned it works. But with no search, no graph, and coverage.
    Any update regarding this?
    Thanks!

  8. matworks-awais commented on Aug 1, 2021

    @matworks-awais

    Yes this issue still exist.

  9. gleisonkz commented on Aug 26, 2021

    @gleisonkz

    I'm facing the same problem

  10. tofikabdullayev commented on Nov 10, 2021

    @tofikabdullayev

    same issue here

  11. rasmus-e-christensen commented on Feb 25, 2022

    @rasmus-e-christensen

    Same issue here

  12. paolagodoy commented on Jul 28, 2022

    @paolagodoy

    Same issue here
    Unhandled Rejection at: Promise {
    SyntaxError: JSON5: invalid character '(' at 1:1
    at syntaxError (/node_modules/json5/lib/parse.js:1083:17)
    at invalidChar (/node_modules/json5/lib/parse.js:1028:12)
    at Object.value (/node_modules/json5/lib/parse.js:287:15)

  13. emekaelo commented on Aug 6, 2023

    @emekaelo

    This issue is still happening in 1.1.21

  14. avrahamwn commented on Aug 14, 2023

    @avrahamwn

    I got the same issue.
    When adding the --disableRoutesGraph flag to the commnd it works, but actually my main goal is to get this specific graph...
    If I may guess, the cause to this bug is something related to not using simple string as route pathes. In my case, I use enums and Map objects such as:

    {
            path: AppRoutePaths.LOGIN,
            component: LoginComponent
    },
    

    Any help here?

  15. emekaelo commented on Aug 31, 2023

    @emekaelo

    So sorry for not replying to this way earlier @avrahamwn
    The solution for me was to add an explicit value to the enum properties. In my case the first one had an explicit value of 1 while the second which caused the error had an implicit value of 2 so I had to specify explicitly with = 2.

    #1124 (comment) was how I traced the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions