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

ng help generate: crashes on Angular 5.2.2 #9412

Closed
h-bex opened this issue Jan 27, 2018 · 14 comments

Comments

Projects
None yet
@h-bex
Copy link

commented Jan 27, 2018

Versions

$ ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.6
Node: 8.9.4
OS: win32 x64
Angular: 5.2.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.6
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.6
@schematics/angular: 0.1.17
typescript: 2.4.2
webpack: 3.10.0

Windows Version: Windows 10 Version 1709

Repro steps

  • ng help generate
  • Alternative: ng help generate service

Observed behavior

$ ng help generate service
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
    at Class.getCollectionName (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\commands\generate.js:57:36)
    at Class.printDetailedHelp (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\commands\generate.js:179:37)
    at commandFiles.forEach.cmd (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\commands\help.js:57:38)
    at Array.forEach (<anonymous>)
    at Class.run (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\commands\help.js:36:22)
    at resolve (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\ember-cli\lib\models\command.js:240:12)
    at Promise.resolve.then.then (D:\Users\harbmihi\Projects\WebProjects\Learning\Udemy\Angular5\Downloads\services-start\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:140:24)
    at <anonymous>

Desired behavior

  • Program shall not crash
  • Program shall give valid output

Mention any other details that might be useful (optional)

N/A

@angelkenneth

This comment has been minimized.

Copy link

commented Jan 28, 2018

Noticed this issue too because Webstorm is using this command to know the available things that generate can do. This issue seems to only exists on @angular/cli==1.6.6; because when i downgrade to @angular/cli==1.6.5 the issue doesn't occur anymore.

@denofevil

This comment has been minimized.

Copy link

commented Jan 28, 2018

Dennis from WebStorm team here. I can confirm that this fails with the same output for me. We'll be releasing WebStorm 2017.3.4 with a workaround (loading predefined list if the command fails), but would love to get a proper fix.

@chriskyndrid

This comment has been minimized.

Copy link

commented Jan 28, 2018

@denofevil, also experiencing the issue with 1.6.6. Thanks for your efforts on the workaround. @h-bex thanks for reporting the issue.

@raven1152

This comment has been minimized.

Copy link

commented Jan 30, 2018

I also noticed this due to the interaction with WebStorm. Actual generate commands still seem to work, and top level help seems to work, as does help on other commands... just not for the generate command.

@kayvanbree

This comment has been minimized.

Copy link

commented Jan 31, 2018

Same here on 1.6.6 in Webstorm. Updated Angular CLI because of another bug, so I'll have to manually (cmd) generate my components for now.

@Flash1232

This comment has been minimized.

Copy link

commented Feb 1, 2018

Is this fixed in 1.6.7?

@h-bex

This comment has been minimized.

Copy link
Author

commented Feb 1, 2018

This is not fixed in 1.6.7:

ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular:
...

The behavior of the help generate command:

ng help generate
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
    at Class.getCollectionName (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\commands\generate.js:57:36)
    at Class.printDetailedHelp (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\commands\generate.js:179:37)
    at commandFiles.forEach.cmd (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\commands\help.js:57:38)
    at Array.forEach (<anonymous>)
    at Class.run (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\commands\help.js:36:22)
    at resolve (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:240:12)
    at Promise.resolve.then.then (D:\Users\harbmihi\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:140:24)
    at <anonymous>

@h-bex h-bex closed this Feb 1, 2018

@h-bex

This comment has been minimized.

Copy link
Author

commented Feb 1, 2018

Sorry; wrong button; have to reopen it again.

@h-bex h-bex reopened this Feb 1, 2018

@hansl hansl assigned hansl and Brocco and unassigned hansl Feb 6, 2018

Brocco added a commit to Brocco/angular-cli that referenced this issue Feb 7, 2018

Brocco added a commit to Brocco/angular-cli that referenced this issue Feb 7, 2018

@DeanMcAndrews

This comment has been minimized.

Copy link

commented Feb 8, 2018

Hi everyone!
I'm getting the same issue whenever I type "ng g --help"
Output: Cannot read property '0' of undefined

This is the version I've got installed in my lap:
ng --version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular: 5.2.3

Thanks in advance...

@WaltDaniels

This comment has been minimized.

Copy link

commented Feb 8, 2018

Same issue here with the "ng g --help" command.

_ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _ | | | | |/ ` | '__| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular: 5.2.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.2.0
@angular/cli: 1.6.7
@angular/material: 5.2.0
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

C:\Code\angularmaterial>ng g --help
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
at Class.getCollectionName (C:\Code\angularmaterial\node_modules@angular\cli\commands\generate.js:57:36)
at Class.printDetailedHelp (C:\Code\angularmaterial\node_modules@angular\cli\commands\generate.js:179:37)
at commandFiles.forEach.cmd (C:\Code\angularmaterial\node_modules@angular\cli\commands\help.js:57:38)
at Array.forEach ()
at Class.run (C:\Code\angularmaterial\node_modules@angular\cli\commands\help.js:36:22)
at resolve (C:\Code\angularmaterial\node_modules@angular\cli\ember-cli\lib\models\command.js:261:20)
at new Promise ()
at Class.validateAndRun (C:\Code\angularmaterial\node_modules@angular\cli\ember-cli\lib\models\command.js:240:12)
at CLI.callHelp (C:\Code\angularmaterial\node_modules@angular\cli\ember-cli\lib\cli\cli.js:222:17)
at Promise.resolve.then.then.then.then.result (C:\Code\angularmaterial\node_modules@angular\cli\ember-cli\lib\cli\cli.js:156:23)
`

@Matmo10

This comment has been minimized.

Copy link

commented Feb 8, 2018

Still occurs on 1.7.0-rc.0

Angular CLI: 1.7.0-rc.0
Node: 8.6.0
OS: darwin x64
Angular: 6.0.0-beta.1
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router

@angular/animations: 6.0.0-beta.2
@angular/cdk: 5.0.1
@angular/cli: 1.7.0-rc.0
@angular/material: 5.0.1
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0-rc.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript-collections: 1.2.5
typescript: 2.6.2
webpack: 3.10.0

Really missing this functionality in IntelliJ ._.

@md8n

This comment has been minimized.

Copy link

commented Feb 15, 2018

Still occurs with 1.6.8

/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.8
Node: 8.9.3
OS: win32 x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

@angular/cli: 1.6.8
@angular/service-worker: 1.0.0-beta.16
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.3.4
webpack: 3.10.0

C:\Projects\Fdc.web>ng help generate
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
@webcat12345

This comment has been minimized.

Copy link

commented Feb 15, 2018

Same issue with Webstorm 2017 3.4

WebStorm 2017.3.4
Build #WS-173.4548.30, built on January 30, 2018
Licensed to ****

JRE: 1.8.0_152-release-1024-b11 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 3.19.0-25-generic

Brocco added a commit to Brocco/angular-cli that referenced this issue Feb 15, 2018

@hansl hansl closed this in #9619 Feb 15, 2018

hansl added a commit that referenced this issue Feb 15, 2018

Brocco added a commit that referenced this issue Feb 15, 2018

@h-bex

This comment has been minimized.

Copy link
Author

commented Feb 16, 2018

Confirmation: Bug has been fixed with Angular 1.7.0:

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.0
Node: 8.9.4
OS: win32 x64
Angular:
...

Output:

ng help generate
Available schematics:
    application
    class
    component
    directive
    enum
    guard
    interface
    module
    pipe
    service
    universal
    appShell

Result: Works as expected. Thank you!

hansl added a commit that referenced this issue Feb 21, 2018

dond2clouds added a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.