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 ()
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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


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 &amp;&amp; new Set(aliases);
yield {schematicName, schematicAliases, collectionName};
}
}
}
}
}


Error: Unknown argument: my-page

It gives me this error.



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.



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.
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

React Dev Vacancy

KeenThemes is looking for a Junior React or Vue developer to build awesome apps.
Apply
keenthemes mega bundle