Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

ng g c my-page on new version with error


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)


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Great. Feel free to let us know if you need more help.

Thanks


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

Hi

Please try this.


npm uninstall -g @angular/cli
npm install -g @angular/cli@latest


Remove the package-lock.json file. Remove the node_modules folder.

Then retry with your command,


npm install
ng g c my-page


Thanks



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.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(