Whenever I try to generate the documentation, I receive this error:
reason: Error: Could not find the node's symbol.
I saw this error has been filed several times, it should be assessed to be honest.
OS: MacOS
Node.js: 12.13.0
npm: 6.13.7
compodoc: 1.1.11
package.json file in the root folder{
"name": "PRIVATE",
"version": "PRIVATE",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"test_cc": "ng test --code-coverage --source-map",
"lint": "ng lint",
"serve": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve --prod",
"build_prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod",
"commit:init": "git config --local commit.template ./tools/.git-commit-template.txt",
"compodoc": "npx compodoc -p ./tsconfig.json"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.2.4",
"@angular/cdk": "^8.1.4",
"@angular/common": "^8.2.4",
"@angular/compiler": "^8.2.4",
"@angular/core": "^8.2.4",
"@angular/forms": "^8.2.4",
"@angular/material": "^8.1.4",
"@angular/material-moment-adapter": "^8.1.4",
"@angular/platform-browser": "^8.2.4",
"@angular/platform-browser-dynamic": "^8.2.4",
"@angular/pwa": "^0.803.9",
"@angular/router": "^8.2.4",
"@angular/service-worker": "^8.2.4",
"@auth0/angular-jwt": "^2.1.2",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^6.1.2",
"@ngx-translate/core": "^10.0.2",
"@ngx-translate/http-loader": "^3.0.1",
"@swimlane/ngx-charts": "^12.0.1",
"@swimlane/ngx-graph": "^6.1.0",
"@turf/turf": "^5.1.6",
"@types/jspdf": "^1.3.1",
"angular-tree-component": "8.5.2",
"core-js": "^2.6.9",
"d3": "^5.11.0",
"dexie": "^2.0.4",
"fabric": "^3.4.0",
"html2canvas": "^1.0.0-rc.3",
"intl": "^1.2.5",
"jquery": "^3.4.1",
"jspdf": "^1.5.3",
"moment": "^2.24.0",
"ng2-dragula": "^2.1.1",
"ngx-device-detector": "^1.3.19",
"ngx-papaparse": "^4.0.4",
"ngx-summernote": "^0.5.5",
"ngx-toastr": "^9.2.0",
"ngx-translate-multi-http-loader": "^3.0.0",
"ngx-tui-image-editor": "^7.0.2",
"ol": "^5.3.3",
"rxjs": "^6.5.2",
"snazzy-info-window": "^1.1.1",
"stream": "0.0.2",
"summernote": "^0.8.12",
"timers": "^0.1.1",
"tslib": "^1.10.0",
"tui-image-editor": "^3.7.0",
"xml-js": "^1.6.11",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.6",
"@angular/cli": "~8.0.6",
"@angular/compiler-cli": "^8.2.4",
"@angular/language-service": "^8.2.4",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^8.10.53",
"acorn": "^6.3.0",
"angular-tslint-rules": "^1.18.0",
"codelyzer": "^5.0.1",
"commitizen": "^4.0.3",
"git-branch": "^2.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"parcel-bundler": "^1.12.3",
"shallow-render": "^8.2.1",
"ts-loader": "6.2.1",
"ts-node": "~5.0.1",
"tslint": "^5.19.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "~3.4.5"
},
"config": {
"commitizen": {
"path": "./tools/.cz-config.js"
}
}
}
globally
All my *-routing.module.ts
Unhandled Rejection at: Promise {
<rejected> InvalidOperationError: Could not find the node's symbol.
at InvalidOperationError.BaseError [as constructor] (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
at new InvalidOperationError (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
at Object.throwIfNullOrUndefined (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
at Identifier.Node.getSymbolOrThrow (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23)
at RouterParserUtil.cleanFileDynamics (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18)
at AngularDependencies.getSourceFileDecorators (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
at /Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
at Array.map (<anonymous>)
at AngularDependencies.getDependencies (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
at CliApplication.Application.getDependenciesData (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
} reason: InvalidOperationError: Could not find the node's symbol.
at InvalidOperationError.BaseError [as constructor] (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
at new InvalidOperationError (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
at Object.throwIfNullOrUndefined (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
at Identifier.Node.getSymbolOrThrow (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/node_modules/ts-simple-ast/dist/compiler/common/Node.js:131:23)
at RouterParserUtil.cleanFileDynamics (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5668:18)
at AngularDependencies.getSourceFileDecorators (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
at /Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
at Array.map (<anonymous>)
at AngularDependencies.getDependencies (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
at CliApplication.Application.getDependenciesData (/Users/dimitrirodriguesoliveira/.nvm/versions/node/v12.13.0/lib/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
[12:16:13] 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)
Cannot generate the documentation
Use compodoc on any complex lazy-loading app
Yes, many that are flagged as wontfix
I'm not sure if that's related, but I'm experiencing a similar issue with lazy routed modules. The error message is different though.
{
matcher: productListingMatcher,
data: {
title: '{category} Site name',
},
resolve: {
category: CategoryResolver,
},
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
loadChildren: () => import('@/app/pages/product-listing/product-listing.module').then(m => m.ProductListingModule),
}
(node:10583) UnhandledPromiseRejectionWarning: RangeError: Invalid array length...
I tried commenting out the loadChildren: ... part and everything seems to pass ok without it. I also tried using the relative path instead of alias in the import src, but that didn't help.
@Flyrell I'm also experiencing the same problem.
+1
I have the same issue
Guys, check your routes definition.
I changed const routes: Routes = [...] to const routes: Route[] = [..], and it's working.
Guys, check your routes definition.
I changed const routes: Routes = [...] to const routes: Route[] = [..], and it's working.
That's works but typescript warns Argument of type Routes[] is not assignable to parameter of type 'Routes'
the solution from @iamruslanbakirov works for me. Yet I don't even know why.
The compodoc generator fails when using Routes (which is Angulars default route syntax) instead of Route[], greeting you with the following error.
[12:22:59] Analysing routes definitions and clean them if necessary
Unhandled Rejection at: Promise {
<rejected> InvalidOperationError: Could not find the node's symbol.
What's confusing about this is that in Angulars source code, Routes itself is simply:
export declare type Routes = Route[]; (an array of Route-Objects)
However: Replacing all const routes: Routes with const routes: Route[] in all of your *-routing.module.ts files does the trick.
To me it looks like some serious bugs in compodoc. That all related issues are marked with wontfix makes this tool even more frustrating.
I've replaced the Typing from :Routes to Route[] but now compodoc does not generae a routing digram.
const routes: Route[]
It's doesn't work. if u open documentation, "Routing" section not show
@vogloblinsky same issue that this: https://github.com/compodoc/compodoc/issues/954, the end problem is the same
It's doesn't work. if u open documentation, "Routing" section not show
at least the documentation was generated at all. With using Routes instead of Route[] not even the generator finishes
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.
Hi,
any idea to this bug?
Ty
any idea to this bug?
The last release is older than one year, due to this bug this tool is basically unusable, the last commits are from October.
I'd suggest to find an alternative.
I'm not sure if that's related, but I'm experiencing a similar issue with lazy routed modules. The error message is different though.
Code
{ matcher: productListingMatcher, data: { title: '{category} Site name', }, resolve: { category: CategoryResolver, }, runGuardsAndResolvers: 'paramsOrQueryParamsChange', loadChildren: () => import('@/app/pages/product-listing/product-listing.module').then(m => m.ProductListingModule), }Error
(node:10583) UnhandledPromiseRejectionWarning: RangeError: Invalid array length...I tried commenting out the
loadChildren: ...part and everything seems to pass ok without it. I also tried using the relative path instead of alias in the import src, but that didn't help.
I had a similar issue, I was able to get it to parse the routes and files, by adjusting my matcher parameter. As others have noticed the regex that scans each file seems to break inside of complicated angular routes. In particular I found that it was failing when it reached the text 'url.length' but only when it was part of truthy conditional statement. I fixed my code by using Boolean(NullPointerExceptionCheck && url.length). Do you have something similar in your matcher? If not, you can test where the issue is by removing the routes that have lazy loaders in them, running compodoc and verifying that it completes successfully as you add each one back into your routing-module. I have single depth sub modules, I have not attempted this with dynamically loaded sub-modules.
Compodoc does not understand lazy loading when written with an arrow function with parentheses (m) => m.MyModule.
node_modules/@compodoc/compodoc/dist/application-54cd2170.js/(['"]loadChildren['"]:)\(\)=>"import\((\\'|'|")([^'"]+?)(\\'|'|")\)\.then\(\w+?=>\S+?\.([^)]+?)\)(\\'|'|")/g;/(['"]loadChildren['"]:)\(\)=>"import\((\\'|'|")([^'"]+?)(\\'|'|")\)\.then\(\(?\w+?\)?=>\S+?\.([^)]+?)\)(\\'|'|")/g;
Most helpful comment
the solution from @iamruslanbakirov works for me. Yet I don't even know why.
The compodoc generator fails when using
Routes(which is Angulars default route syntax) instead ofRoute[], greeting you with the following error.What's confusing about this is that in Angulars source code,
Routesitself is simply:export declare type Routes = Route[];(an array of Route-Objects)However: Replacing all
const routes: Routeswithconst routes: Route[]in all of your*-routing.module.tsfiles does the trick.To me it looks like some serious bugs in compodoc. That all related issues are marked with
wontfixmakes this tool even more frustrating.