Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] InvalidOperationError: Could not find the node's symbol -> Unhandled Rejection #1042

Closed
Sebastian-G opened this issue Mar 19, 2021 · 9 comments

Comments

@Sebastian-G
Copy link

Running the "compodoc -p tsconfig.json src --hideGenerator --assetsFolder readme" command results in an error.

Please help me fixing it.

[11:48:29] Analysing routes definitions and clean them if necessary
Unhandled Rejection at: Promise {
  <rejected> InvalidOperationError: Could not find the node's symbol.
      at InvalidOperationError.BaseError [as constructor] (/top-secret/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
      at new InvalidOperationError (/top-secret/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
      at Object.throwIfNullOrUndefined (/top-secret/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
      at Identifier.Node.getSymbolOrThrow (/top-secret/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23)
      at RouterParserUtil.cleanFileDynamics (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18)
      at AngularDependencies.getSourceFileDecorators (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
      at /top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
      at Array.map (<anonymous>)
      at AngularDependencies.getDependencies (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
      at CliApplication.Application.getDependenciesData (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
} reason: InvalidOperationError: Could not find the node's symbol.
    at InvalidOperationError.BaseError [as constructor] (/top-secret/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
    at new InvalidOperationError (/top-secret/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
    at Object.throwIfNullOrUndefined (/top-secret/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
    at Identifier.Node.getSymbolOrThrow (/top-secret/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23)
    at RouterParserUtil.cleanFileDynamics (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18)
    at AngularDependencies.getSourceFileDecorators (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
    at /top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
    at Array.map (<anonymous>)
    at AngularDependencies.getDependencies (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
    at CliApplication.Application.getDependenciesData (/top-secret/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
[11:48:30] Sorry, but there was a problem during parsing or generation of the documentation. Please fill an issue on github. (https://github.com/compodoc/compodoc/issues/new)

Originally posted by @Sebastian-G in #1000 (comment)

@Sebastian-G Sebastian-G changed the title Analysing routes definitions and clean them if necessary -> Unhandled Rejection at: Promise InvalidOperationError: Could not find the node's symbol -> Unhandled Rejection Mar 19, 2021
@Sebastian-G
Copy link
Author

I was able to fix my issue by changing the Routes array type 😞

Related to #525 see following command:
#525 (comment)

Please fix this 🐛

@vogloblinsky vogloblinsky changed the title InvalidOperationError: Could not find the node's symbol -> Unhandled Rejection [BUG] InvalidOperationError: Could not find the node's symbol -> Unhandled Rejection Apr 13, 2021
@fstodulski
Copy link

This one works:

  {
    path: 'forms',
    loadChildren: () =>
      import('./screens/forms/forms.module').then((m) => m.FormsModule),
  },
  {
    path: 'buttons',
    loadChildren: () =>
      import('./screens/buttons/buttons.module').then((m) => m.ButtonsModule),
  },

this doesn't:

  {
  path: 'forms',
  loadChildren: async () =>
    (await import('./screens/forms/forms.module')).FormsModule,
},
{
  path: 'buttons',
  loadChildren: async () =>
    (await import('./screens/buttons/buttons.module')).ButtonsModule,
},

@fstodulski
Copy link

image

@Sebastian-G
Copy link
Author

Sebastian-G commented May 21, 2021

We are already using the import(...).then(...) Promise.
And the issue occurred.

{
    path: '/test',
    loadChildren: () => import('./routes/test').then(mod => mod.TestModule),
    ...
  },
  • Compodoc: 1.1.11
  • TypeScript version used by Compodoc : 2.9.1
  • TypeScript version of current project : 4.1.5
  • Node.js version : v14.15.3
  • Operating system : macOS Big Sur

HINT:

  • It works with --minimal flag

@Sebastian-G
Copy link
Author

Sebastian-G commented Jun 24, 2021

Any news?

Could be related to #1066

@Sebastian-G
Copy link
Author

Sebastian-G commented Jun 24, 2021

I was able to fix the issue by adding <ENUM>.ofValue() to all Roles. 👎

In addition it seems only to be an issue if the Enum is imported by ts shorted paths (see tsconfig.json). e.g import {Role} from '@shared/models'; on another file, we used the direct import (see import {Role} from '../shared/models';), which didn't require the .ofValue()

@ArtifexEt
Copy link

ArtifexEt commented Jun 29, 2021

I have seen few bugs closed with this problem. .ofValue() or change files to direct import is not a solution. Please think about fixing this problem instead of closing tickets.

@sgabb
Copy link

sgabb commented Jun 30, 2021

Same error for me (Angular 11.2, compodoc 1.1.11):

[] parsing: /path/src/app/modules/main/main-routing.module.ts [] Analysing routes definitions and clean them if necessary Unhandled Rejection at: Promise { <rejected> InvalidOperationError: Could not find the node's symbol. at InvalidOperationError.BaseError [as constructor] (/path/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28) at new InvalidOperationError (/path/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28) at Object.throwIfNullOrUndefined (/path/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15) at Identifier.Node.getSymbolOrThrow (/path/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23) at RouterParserUtil.cleanFileDynamics (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18) at AngularDependencies.getSourceFileDecorators (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46) at /path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31 at Array.map (<anonymous>) at AngularDependencies.getDependencies (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21) at CliApplication.Application.getDependenciesData (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40) } reason: InvalidOperationError: Could not find the node's symbol. at InvalidOperationError.BaseError [as constructor] (/path/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28) at new InvalidOperationError (/path/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28) at Object.throwIfNullOrUndefined (/path/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15) at Identifier.Node.getSymbolOrThrow (/path/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23) at RouterParserUtil.cleanFileDynamics (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18) at AngularDependencies.getSourceFileDecorators (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46) at /path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31 at Array.map (<anonymous>) at AngularDependencies.getDependencies (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21) at CliApplication.Application.getDependenciesData (/path/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40) [17:20:50] Sorry, but there was a problem during parsing or generation of the documentation. Please fill an issue on github. (https://github.com/compodoc/compodoc/issues/new) npm ERR! code ELIFECYCLE npm ERR! errno 1

Routing module is something like:

const routes: Routes = [ { path: '', component: MainComponent, canActivate: [Guard1, AuthGuard], children: [ { path: '', canActivateChild: [AuthGuard], children: [ { path: environment.urlApp.url1, loadChildren: () => import('./m1/m1.module').then(m => m.M1Module) }, { path: environment.urlApp.url2, loadChildren: () => import('./m2/m2.module').then(m => m.M2Module) }, { path: environment.urlApp.url3, loadChildren: () => import('./m3/m3.module').then(m => m.M3Module) } ] } ] } ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) export class MainRoutingModule { }

@vogloblinsky vogloblinsky added this to the 1.1.13 milestone Jul 2, 2021
@vogloblinsky vogloblinsky modified the milestones: 1.1.13, 1.1.14, 1.1.15 Jul 9, 2021
@vogloblinsky
Copy link
Contributor

Fixed for these syntaxes :

{
        path: 'about',
        loadChildren: './about/about.module#AboutModule'
}
{
        path: 'about',
        loadChildren: (): Promise<AboutModule> => import('./about/about.module').then(m => m.AboutModule)
}
{
        path: 'about',
        loadChildren: () => import('./about/about.module').then(m => m.AboutModule)
}
{
        path: 'about',
        loadChildren: async () => (await import('./about/about.module')).AboutModule
}

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

No branches or pull requests

5 participants