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] RangeError: Invalid array length #209

Closed
Robouste opened this issue Jun 23, 2017 · 16 comments
Closed

[BUG] RangeError: Invalid array length #209

Robouste opened this issue Jun 23, 2017 · 16 comments

Comments

@Robouste
Copy link

Robouste commented Jun 23, 2017

Overview of the issue

Error while generating the doc :
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): RangeError: Invalid array length

Operating System, Node.js, npm, compodoc version(s)

Windows 7
Node 6.10.2
Npm 3.10.10
compodoc 1.0.0-beta.10
angular-cli 1.0.6

Angular configuration, a package.json file in the root folder
{
  "name": "angular-cli-seed",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": ".\\node_modules\\.bin\\ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/material": "^2.0.0-beta.6",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "bootstrap": "^3.3.7",
    "chart.js": "^2.6.0",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "jquery": "^2.2.1",
    "morris.js": "^0.5.0",
    "ng2-charts": "^1.6.0",
    "ng2-drag-drop": "^2.0.1",
    "ngx-pipes": "^1.6.1",
    "rxjs": "^5.1.0",
    "web-animations-js": "^2.2.5",
    "webpack-raphael": "^2.1.4",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.6",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}
Compodoc installed globally or locally ?

globally

Motivation for or Use Case

I would like to generate the doc

Reproduce the error

Command line used :
compodoc -p .\src\tsconfig.app.json

Here is the component for which it fails. If I remove all the class content, the doc is generated successfully:

import { Component, Input, OnDestroy  } from "@angular/core";

@Component({
    selector: "loading-helper",
    templateUrl: "loading-helper.component.html",
    styleUrls: ["loading-helper.component.scss"]
}) 
export class LoadingHelperComponent implements OnDestroy  {

    public visible: boolean = true;
    public timeout: any;

    /**
    * @description : if needed, we can wait before showing the spinner
    **/
    @Input() delay: number = 0;

    /**
    * @description : The text above the spinner ("loading", "no results", etc)
    **/
    @Input() feedback: string;

    @Input() public set isRunning(value: boolean) {
        if (!value) {
            this.cancel();
            this.visible = false;
            return;
        }

        if (this.timeout) {
            return;
        }

        this.timeout = setTimeout(() => {
            this.visible = true;
            this.cancel();
        }, this.delay);
        
    }

    private cancel(): void {
        clearTimeout(this.timeout);
        this.timeout = undefined;
    }

    ngOnDestroy(): void {
        this.cancel();
    }
}
Related issues

#103 #169

@vogloblinsky
Copy link
Contributor

@Robouste Just tested your component code inside the demo project (https://github.com/compodoc/compodoc-demo-todomvc-angular).
I have just delete all the modules/component, only keep app.component.ts, and copy-pasted your code. No problem for me.

Can i have your terminal logs ?

@Robouste
Copy link
Author

Is there a command to output the log to a file ? I don't know how to give them to you

@vogloblinsky
Copy link
Contributor

@Robouste
Copy link
Author

Robouste commented Jun 26, 2017

log : https://pastebin.com/jj0CscV5

@didevgen
Copy link

The issue happens in latest version (1.0.0-beta.10). And it is related to Input and Output decorators (just remove them and the parsing process goes next).
Downgrading to 1.0.0-beta.9 helps.

@vogloblinsky
Copy link
Contributor

@didevgen
Do you have an example of failing @input or @output ?

@Robouste
Copy link
Author

I can confirm it's working with version 1.0.0-beta.9

@vogloblinsky
Copy link
Contributor

@didevgen
Thanks for the pastebin links, but i cannot reproduce it without all the files listed. As TypeScript parser handles them, just copy-pasting your @output example didn't failed for me.

Is it possible to clean as possible the AccountLookupComponent with just the code which breaks, all if possible too the files imported ?

I will try to reproduce it with the compodoc demo project.

Thanks

@didevgen
Copy link

didevgen commented Jun 28, 2017

@vogloblinsky
Hello!
Here is the pastebin with no project imports: https://pastebin.com/VSGRrLtg

I've used 1.0.0.beta.10 version and my parsing process stoped and here is the output in console: https://pastebin.com/y87PQfe1

@vogloblinsky
Copy link
Contributor

@didevgen
Still no failing when i copy-pasting your AccountLookupComponent in a new file. 😡

Can you please create a zip of your cleaned and failing project ?

Thanks by advance.

@didevgen
Copy link

didevgen commented Jun 28, 2017

@vogloblinsky
I'm sorry, but I can't, because it is not my own project.

I tried also to add the copy of failed component into the same folder, and I unexpectedly found, that it had been parsed successfuly, but the original one failed.

I can just tell, that not all files which have @input or @output decorators are failed.

image

@vogloblinsky vogloblinsky added this to the 1.0.0 milestone Jun 30, 2017
@tme321
Copy link

tme321 commented Jul 12, 2017

Just adding my 2 cents in, having the same issue. A single file, if I remove the code from it everything else works and docs get generated. With this file it doesn't work.

https://github.com/tme321/Unopinionated-Angular/blob/master/src/lib/dropdown-input/dropdown-input-item-list.component.ts

@shwedberlin
Copy link

Similar issue in my project: RangeError: Invalid array length, but no UnhandledPromiseRejectionWarning
I have also @input and @output directives in failed file.
Project: https://github.com/shwedberlin/AngularWebApi

@vogloblinsky
Copy link
Contributor

vogloblinsky commented Jul 13, 2017

@shwedberlin : ok bug found, in @input/@output parsing, fixed for your project.
Coming in next release 1.0.0-beta.13

@tme321 In which folder of your repository do you run compodoc ?
EDIT : i have tested src/lib folder, same bug as @shwedberlin.

@tme321
Copy link

tme321 commented Jul 13, 2017

Honestly I didn't get far enough to figure out where exactly to run compodoc. Ideally it would just be /src/lib but I was just trying to get it to work pointed at /src.

@lock
Copy link

lock bot commented Oct 1, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants