Skip to content

materialNav schematics/collision in latest version #11632

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
jayChrono opened this issue Jul 24, 2018 · 20 comments
Closed

materialNav schematics/collision in latest version #11632

jayChrono opened this issue Jul 24, 2018 · 20 comments

Comments

@jayChrono
Copy link

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.

@joshstir
Copy link

Thanks for putting your fix in there, this was driving me crazy.

@tomasvaedelund
Copy link

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.

@kartikwatwani
Copy link

Worked for me thanks :)

@IAfanasov
Copy link

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.

@thesayyn
Copy link

is there any workaround for this issue ?

@IAfanasov
Copy link

@thesayyn two workarounds have been already listed in this topic. read above

@LAMASLAYER
Copy link

I moved the line as suggested by @tomasvaedelund and it worked fine for me.

@filipesilva
Copy link
Contributor

I believe this was fixed by #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.

@HARINI-VARADHARAJAN
Copy link

got it fixed. thank you @jayChrono

@AnshulMahajan10
Copy link

thanks

@GuanYuMin
Copy link

thanks bro, @jayChrono

@codefordream2014
Copy link

Thanks it worked for me. @jayChrono

@itsd2112
Copy link

thnx @jayChrono
i changed allNames.push(...aliases); to allNames.push(alias); at line 127 . and it worked fine

@eudys07
Copy link

eudys07 commented Jul 25, 2018

Thanks all, what @tomasvaedelund said work fine for me.

@AnshulMahajan10
Copy link

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

image

@JoshWilliams92
Copy link

Changing allNames.push(...aliases); to allNames.push(aliases) worked for me.

@gags88
Copy link

gags88 commented Jul 30, 2018

Angular CLI 6.1 has a fix for it.. try running ng update @angular/cli

@diemgomez
Copy link

diemgomez commented Nov 4, 2018

I changed the line 127 just like @jayChrono said and it worked. Thanks man!!

@slim-souissi
Copy link

what is line 127 please ?

@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 8, 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

No branches or pull requests