-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
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
Package Version
@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
Repro steps
ng new my-app
npm install @angular/material @angular/cdk --save
npm install @angular/animations
ng generate @angular/material:material-nav --name test-nav
The log given by the failure
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. (C:\Users\Jay\git\my-resume\node_modules@angular\cli\commands\generate.js:38:53)
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)
Desired functionality
It should generate the component from the schematic without error.
Mention any other details that might be useful
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.