When making the command "ng g c my-page" from demo2 Angular, it gets the following error:
An unhandled exception occurred: Cannot destructure property 'aliases' of 'collection.description.schematics[schematicName]' as it is undefined.
See "/private/var/folders/bn/xgpdjvcx5g7b775bk7x25nl40000gn/T/ng-Hu6Vuu/angular-errors.log" for further details.
The log is below:
[error] TypeError: Cannot destructure property 'aliases' of 'collection.description.schematics[schematicName]' as it is undefined.
at GenerateCommandModule.getSchematics (/Users/brunojacinto/Documents/Coding/demo2/node_modules/@angular/cli/src/commands/generate/cli.js:141:29)
at getSchematics.next (<anonymous>)
at GenerateCommandModule.getSchematicsToRegister (/Users/brunojacinto/Documents/Coding/demo2/node_modules/@angular/cli/src/commands/generate/cli.js:158:76)
at async GenerateCommandModule.builder (/Users/brunojacinto/Documents/Coding/demo2/node_modules/@angular/cli/src/commands/generate/cli.js:35:55)
at async runCommand (/Users/brunojacinto/Documents/Coding/demo2/node_modules/@angular/cli/src/command-builder/command-runner.js:113:5)
at async default_1 (/Users/brunojacinto/Documents/Coding/demo2/node_modules/@angular/cli/lib/cli/index.js:70:16)
Great. Feel free to let us know if you need more help.
Thanks
Hi
Please try this.
npm uninstall -g @angular/cli
npm install -g @angular/cli@latest
npm install
ng g c my-page
Worked fine, tks.
Hi I managed to solve this issue by editing node_modules/@angular/cli/src/commands/generate/cli.js
It is at most temporal solution but hey it works...
async *getSchematics() {
const seenNames = new Set();
for (const collectionName of await this.getCollectionNames()) {
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
const collection = workflow.engine.createCollection(collectionName);
for (const schematicName of collection.listSchematicNames(true /** includeHidden */)) {
// If a schematic with this same name is already registered skip.
if (!seenNames.has(schematicName)) {
if(collection.description.schematics[schematicName]) { //FIX HERE
seenNames.add(schematicName);
const {aliases} = collection.description.schematics[schematicName];
const schematicAliases = aliases && new Set(aliases);
yield {schematicName, schematicAliases, collectionName};
}
}
}
}
}
Error: Unknown argument: my-page
It gives me this error.