x)- [x] bug report -> please search issues before submitting
- [ ] feature request
x)- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.0.9
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@angular/material 6.4.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.2
typescript 2.7.2
webpack 4.8.3
ng new my-app
npm install @angular/material @angular/cdk --save
npm install @angular/animations
ng generate @angular/material:material-nav --name test-nav
Schematics/alias "materialNav" collides with another alias or schematic name.
Error: Schematics/alias "materialNav" collides with another alias or schematic name.
at NodeModulesEngineHost.createCollectionDescription (C:\Users\Jay\git\my-resume\node_modules\@angular-devkit\schematics\tools\file-system-engine-host-base.js:125:27)
at SchematicEngine._createCollectionDescription (C:\Users\Jay\git\my-resume\node_modules\@angular-devkit\schematics\src\engine\engine.js:78:40)
at SchematicEngine.createCollection (C:\Users\Jay\git\my-resume\node_modules\@angular-devkit\schematics\src\engine\engine.js:71:43)
at Object.getCollection (C:\Users\Jay\git\my-resume\node_modules\@angular\cli\utilities\schematics.js:28:31)
at GenerateCommand.getOptions (C:\Users\Jay\git\my-resume\node_modules\@angular\cli\models\schematic-command.js:193:41)
at GenerateCommand.
at Generator.next (
at C:\Users\Jay\git\my-resume\node_modules\@angular\cli\commands\generate.js:7:71
at new Promise (
at __awaiter (C:\Users\Jay\git\my-resume\node_modules\@angular\cli\commands\generate.js:3:12)
It should generate the component from the schematic without error.
I've traced it to line 127 in @angular-devkit/schematics/tools/file-system-host-base.js. The code 'allNames.push(...aliases);' appears to push the array ['material-nav', 'materialNav'] into allNames. Since it's in a for loop, the array gets pushed twice. I manually edited the line to 'allNames.push(alias);' and it generated the component as desired.
Thanks for putting your fix in there, this was driving me crazy.
I just had the same problem but sadly the suggested solution didn't work for me. Instead I moved the line 127: allNames.push(...aliases); outside, just after, the loop so it's now on line 128. Now everything works fine for me.
Worked for me thanks :)
in sources https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/tools/file-system-engine-host-base.ts line
allNames.push(...aliases); already moved out of that cycle.
is there any workaround for this issue ?
@thesayyn two workarounds have been already listed in this topic. read above
I moved the line as suggested by @tomasvaedelund and it worked fine for me.
I believe this was fixed by https://github.com/angular/angular-cli/pull/11390, and the latest 6.1 RC should not have this problem. Please let me know if that's not the case so I can reopen.
got it fixed. thank you @jayChrono
thanks
thanks bro, @jayChrono
Thanks it worked for me. @jayChrono
thnx @jayChrono
i changed allNames.push(...aliases); to allNames.push(alias); at line 127 . and it worked fine
Thanks all, what @tomasvaedelund said work fine for me.
allNames.push(...aliases); to allNames.push(alias); at line 127,
after making this change, this issue got fixed but another issue started when I run command generate component , its giving error, schematics/alias "c" collides with another alias or schematic name,**
I had to undo the code change and this issue went away

Changing allNames.push(...aliases); to allNames.push(aliases) worked for me.
Angular CLI 6.1 has a fix for it.. try running ng update @angular/cli
I changed the line 127 just like @jayChrono said and it worked. Thanks man!!
what is line 127 please ?
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._
Most helpful comment
Thanks for putting your fix in there, this was driving me crazy.