Skip to content

ng generate enum throws error #5018

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

Closed
jasedwards opened this issue Feb 26, 2017 · 6 comments · Fixed by #5023
Closed

ng generate enum throws error #5018

jasedwards opened this issue Feb 26, 2017 · 6 comments · Fixed by #5023
Assignees

Comments

@jasedwards
Copy link

jasedwards commented Feb 26, 2017

Please provide us with the following information:

OS?

Windows 7

Versions.

@angular/cli: 1.0.0-rc.0
node: 6.10.0
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8

Repro steps.

run ng generate enum [name]

The log given by the failure.

TypeError: Cannot read property '0' of undefined
at Object.getAppFromConfig (C:\code\Angular2\dashboards\node_modules@angular\cli\utilities\app-utils.js:4:19)
at Class.normalizeEntityName (C:\code\Angular2\dashboards\node_modules@angular\cli\blueprints\enum\index.js:18:39)
at Class.Blueprint._normalizeEntityName (C:\code\Angular2\dashboards\node_modules@angular\cli\ember-cli\lib\models\blueprint.js:454:24)
at Class.Blueprint.install (C:\code\Angular2\dashboards\node_modules@angular\cli\ember-cli\lib\models\blueprint.js:513:8)
at Class.run (C:\code\Angular2\dashboards\node_modules@angular\cli\ember-cli\lib\tasks\generate-from-blueprint.js:59:49)
at Class.run (C:\code\Angular2\dashboards\node_modules@angular\cli\ember-cli\lib\commands\generate.js:71:17)
at Class. (C:\code\Angular2\dashboards\node_modules@angular\cli\ember-cli\lib\models\command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:103:7)

Mention any other details that might be useful.

ran this as admin in cmder, cmd and git bash with same results

@clydin
Copy link
Member

clydin commented Feb 26, 2017

did you provide a name as an argument? It should require one. If not, the error message should definitely be improved.

@waiholiu
Copy link

waiholiu commented Feb 26, 2017

I'm getting the same error and I am running it with a name as an argument. (eg. ng generate enum hello)

I think it's failing in the file packages/@angular/cli/utilities/app-utils.ts on line 4
let app = apps[0];
the apps variable is undefined, possibly because the packages/@angular/cli/lib/config/schema.json file has not configured enum properly.

Unfortunately I don't know enough how the cli works to be able to be able to offer a fix or to be more help.

@jasedwards
Copy link
Author

Apologies. I did provide a name. I have updated my previous comment

@Brocco Brocco self-assigned this Feb 26, 2017
@Brocco
Copy link
Contributor

Brocco commented Feb 26, 2017

I will take a look at this, thanks for reporting.

@m-ghaoui
Copy link

+1

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants