angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Generating component via: "ng g component someComp" fails @0.0.25.

Open eppjo opened this issue 10 years ago • 11 comments

Created new project via ng new project. Moved into directory. Called: ng g component comp. --> fails.

eppjo avatar Mar 22 '16 18:03 eppjo

Can you please provide some more info?

OS? node version? npm version? directory this was executed from (relative to the project root) error log

Brocco avatar Mar 23 '16 01:03 Brocco

I re-tested this also with 0.0.26. Same issue. (with 0.0.24 everything is fine)

OS: Win7 x64 SP1 Node: v5.9.0 NPM: v3.7.3 directory: C:_projects\ng2project command: ng g component comp

Console-output (I've got some issues to add the picture):

C:_projects>ng new ng2project installing ng2 create .clang-format create config\environment.js create e2e\app.e2e.ts create e2e\app.po.ts create e2e\tsconfig.json create e2e\typings.d.ts create angular-cli-build.js create .gitignore create karma-test-shim.js create karma.conf.js create package.json create protractor.conf.js create src\app\ng2project.html create src\app\ng2project.spec.ts create src\app\ng2project.ts create src\app.ts create src\favicon.ico create src\index.html create src\tsconfig.json create src\typings.d.ts create tslint.json create typings.json Successfully initialized git.

├── es6-shim (ambient) ├── angular-protractor (ambient dev) ├── jasmine (ambient dev) └── selenium-webdriver (ambient dev)

Installed packages for tooling via npm.

C:_projects>cd ng2project

C:_projects\ng2project>node -v v5.9.0

C:_projects\ng2project>npm -v 3.7.3

C:_projects\ng2project>ng -v angular-cli: 0.0.26 node: 5.9.0 os: win32 x64

C:_projects\ng2project>ng g component comp installing component Cannot read property 'indexOf' of undefined TypeError: Cannot read property 'indexOf' of undefined at Class.module.exports.normalizeEntityName (C:_projects\ng2project\node_mo dules\angular-cli\addon\ng2\blueprints\component\index.js:19:19) at Class.Blueprint._normalizeEntityName (C:_projects\ng2project\node_module s\angular-cli\node_modules\angular-cli\lib\models\blueprint.js:434:24) at Class.Blueprint.install (C:_projects\ng2project\node_modules\angular-cli \node_modules\angular-cli\lib\models\blueprint.js:492:8) at Class.module.exports.Task.extend.run (C:_projects\ng2project\node_module s\angular-cli\node_modules\angular-cli\lib\tasks\generate-from-blueprint.js:60:4 9) at Class.module.exports.Command.extend.run (C:_projects\ng2project\node_mod ules\angular-cli\node_modules\angular-cli\lib\commands\generate.js:77:17) at Class. (C:projects\ng2project\node_modules\angular-cli\node modules\angular-cli\lib\models\command.js:151:17) at lib$rsvp$$internal$$tryCatch (C:_projects\ng2project\node_modules\angula r-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (C:_projects\ng2project\node_modules
angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1048:17) at C:_projects\ng2project\node_modules\angular-cli\node_modules\angular-cli \node_modules\rsvp\dist\rsvp.js:331:11 at lib$rsvp$asap$$flush (C:_projects\ng2project\node_modules\angular-cli\no de_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1198:9)

C:_projects\ng2project>

eppjo avatar Mar 23 '16 09:03 eppjo

@Brocco odd... line 19 on angular-cli\addon\ng2\blueprints\component\index.js:19:19 isn't within Class.module.exports.normalizeEntityName anymore: https://github.com/angular/angular-cli/blob/master/addon/ng2/blueprints/component/index.js#L19

filipesilva avatar Mar 23 '16 10:03 filipesilva

I am getting the same error.

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\mlynam\Source\Repos\material>ng g component why-doesnt-this-work
installing component
Cannot read property 'indexOf' of undefined
TypeError: Cannot read property 'indexOf' of undefined
    at Class.module.exports.normalizeEntityName (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\addon\ng2\blueprints\component\index.js:19:19)
    at Class.Blueprint._normalizeEntityName (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\lib\models\blueprint.js:434:24)
    at Class.Blueprint.install (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\lib\models\blueprint.js:492:8)
    at Class.module.exports.Task.extend.run (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\lib\tasks\generate-from-blueprint.js:60:49)
    at Class.module.exports.Command.extend.run (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\lib\commands\generate.js:77:17)
    at Class.<anonymous> (C:\Users\mlynam\Source\Repos\material\node_modules\angular-cli\lib\models\command.js:151:17)
    at lib$rsvp$$internal$$tryCatch (C:\Users\mlynam\Source\Repos\material\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (C:\Users\mlynam\Source\Repos\material\node_modules\rsvp\dist\rsvp.js:1048:17)
    at C:\Users\mlynam\Source\Repos\material\node_modules\rsvp\dist\rsvp.js:331:11
    at lib$rsvp$asap$$flush (C:\Users\mlynam\Source\Repos\material\node_modules\rsvp\dist\rsvp.js:1198:9)

C:\Users\mlynam\Source\Repos\material>ng -v
angular-cli: 0.0.26
node: 5.3.0
os: win32 x64

C:\Users\mlynam\Source\Repos\material>node -v
v5.3.0

C:\Users\mlynam\Source\Repos\material>npm -v
3.5.2

mlynam avatar Mar 23 '16 16:03 mlynam

This seems to be a bad release, looking into cutting a new release with the appropriate fixes in place

Brocco avatar Mar 23 '16 16:03 Brocco

thanks let me know if I can help (newbie to angular cli) but spending part of my day learning new features :>

cfphpflex avatar Mar 23 '16 20:03 cfphpflex

This issue has been resolved with the release of version 0.0.27

Brocco avatar Mar 24 '16 20:03 Brocco

thanks, trying it out

cfphpflex avatar Mar 25 '16 00:03 cfphpflex

Thanks guys. Its working fine.

By the way, I miss the subfolders for components and services, when calling the command I mentioned above. Or am I doing something wrong? Previously, running the command on v0.0.24 "ng generate component comp" a folder "components" has been created: e.g. .../ng2project/src/app/components. The same for services.

eppjo avatar Mar 26 '16 16:03 eppjo

@eppjo the removal of the componemts directory is related to aligning the templates and folder structure to the suggested style guide.

Brocco avatar Mar 26 '16 21:03 Brocco

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.