compodoc: [BUG] Error: Could not find the node's symbol.
Overview of the issue
After upgrading to compodoc 1.1.1 from 1.0.9 I got the reason: Error: Could not find the node's symbol.
error
Operating System, Node.js, npm, compodoc version(s)
compodoc: 1.1.1 node: 9.8.0 mac: High Sierra
Angular configuration, a package.json
file in the root folder
Angular: 5.2.9
Compodoc installed globally or locally ?
locally installed compodoc
Motivation for or Use Case
Cannot generate docs anymore
Reproduce the error
npm script:
./node_modules/.bin/compodoc -p src/tsconfig.app.json -d ./docs -t --theme stripe --disableCoverage --hideGenerator -n \"My Documentation\"
Related issues
1.0.9 compodoc version was working well
Suggest a Fix
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 40 (7 by maintainers)
I am currently seeing this issue as well when routes are being analyzed. This is the initial output of the error:
I believe that this is happening due to our usage of a TS string enumeration to define the
path
of the individual routes. For example: (redacting portions of the config)Enum file:
Routing Module Config:
Not ideal but I got this working by removing the Routes typing, example :
export coreRoutes : Routes = [ ... ]
Change to
export coreRoutes = [ ... ]
Same problem Compodoc version: 1.1.5 Typescript version : 2.9.1 Node.js version : v8.12.0 Operating system : Windows 10
We are using an enum in our route data in the following way:
this gives the
Unhandled Rejection at: Promise
error. It goes away when you remove the Routes typing as suggested by @WebStew above but then Compodoc just doesn’t generate the routes part of the documentation.A fix for now is calling
valueOf()
on the enum:The generation throws no errors and the routes are included in the documentation.
Some extra information. enum is imported as:
Routes are declared as:
@vogloblinsky do you have any idea what is causing the error? Do you need more info/how can I help you pinpoint the issue?
Same here!
Some news?
I am getting this error with compodoc v1.1.2 if I make use of the “data” property on a route with a values that come from an import:
For example, this gives an error:
library.ts
app-routing.module.ts
But this does not give the error:
In my case it happens when route paths are imported from some const
When I comment all the paths declarations - it works. It is also the same on
1.0.9
versionAhh I need to remove the
-t
(silent) option from my script above almost forgot it 😃 The error appears after parsing myhome-routing.module.ts
lazy routes. Additional details is that I have main routes which are lazily loaded and one of them contains the following additional lazy loaded modules inhome-routing.module.ts
:Hope this helps @vogloblinsky
I solved this problem by using the solution @bartios posted earlier in this thread. When defining a Routes array in a routing module, reference enum values by their
.valueOf()
method.So instead of:
data: { fooProperty: FooEnum.FooPermission }
Use:data: { fooProperty: FooEnum.FooPermission.valueof() }
Also having the same issue with version 1.1.8.
This is happening when i reference any route property from environment files e.g.
data: { title: environment.feature.name }
Having the same issue
Compodoc v1.1.7 Angular CLI 7.2.2
Clear up “Routes” types fixes the problem, but I think it’s not okay to do like that
Thanks @WebStew , would be great if @vogloblinsky can solve it in a nice manner. 😉
I had the same issue, and it was definitely my routing. Compodoc works if I change my routes from
to
.
Let us know if you see what caused the issue @vogloblinsky in case of the nested lazy routes above.
Thanks in advance, meanwhile I reverted back to the
1.0.9
working version.Online !
In one or two hours 😉
@shlomiassaf Thanks for the feedback. I will look that asap.
I can confirm this happens to me as well.
I have pinned the issue, but it’s trick to explain so i’ll do my best.
The issue might be external, coming from
ts-simple-ast
For me it happens whenever I use a function call expression where the function is on an object, e.g.
myObj.functionCall()
. If the function is used directly (functionCall()
) it works fine.Example:
In file
utils.ts
I export the following:now in my
app.routes.ts
:The above code will result in the error.
To fix it we just need to use
doWork()
directly so we add:and then use it directly:
Now no errors.
I believe this is coming from
ts-simple-ast
but i’m not sure.