1
I’m starting with angular and I ended up encountering very strange error while trying to execute the command:
ng generate @angular/material:material-nav --name nav-menu
he introduces me to the following satck:
Collection "@angular/material" cannot be resolved.
Error: Collection "@angular/material" cannot be resolved.
at NodeModulesEngineHost._resolveCollectionPath (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:88:15)
at NodeModulesEngineHost.createCollectionDescription (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:106:27)
at SchematicEngine._createCollectionDescription (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:78:40)
at SchematicEngine.createCollection (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:71:43)
at Object.getCollection (/usr/local/lib/node_modules/@angular/cli/utilities/schematics.js:28:31)
at GenerateCommand.getOptions (/usr/local/lib/node_modules/@angular/cli/models/schematic-command.js:193:41)
at GenerateCommand.<anonymous> (/usr/local/lib/node_modules/@angular/cli/commands/generate.js:38:53)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/@angular/cli/commands/generate.js:7:71
at new Promise (<anonymous>)
I tried to reinstall @angular/cli and also delete the node_modules folder, but nothing helped.
I’m in the mood:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.8
Node: 8.11.2
OS: darwin x64
Angular: 6.0.6
... animations, 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 (cli-only)
@angular/cdk 6.3.1
@angular/flex-layout 6.0.0-beta.16
@angular/material 6.3.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8 (cli-only)
@schematics/update 0.6.8 (cli-only)
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3
It worked! I actually went back to version, deleted node_modules and worked
– João Carlos Garcia da Silva