Base solution for your next web application
Open Closed

Angular CLI Generate Component Error #11614


User avatar
0
[email protected] created

I seem to lost the ability to use the Angular CLi to generate a component.

ng g c test-modal-component

Gives the error that the project missing.

Data path "" must have required property 'project'.

What I noticed is the removal of "defaultProject": "abp-zero-template" since it was deprecated and Angular update, I am sure removed it. I can add the --project to the cli call and it works. Was trying to see if anyone else find why the default project name is not being resolved.


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thank you for your report. Probably this is removed accidentally, we will work on this via https://github.com/aspnetzero/aspnet-zero-core/issues/4888

  • User Avatar
    0
    ismcagdas created
    Support Team

    It seems like we should use --project parameter , see https://github.com/angular/angular-cli/issues/23470

  • User Avatar
    0
    [email protected] created

    Some more updates to this.

    Yes using the --project parameter works. But this is supposed to be optional.

    I tried a blank Angular application created using the CLI and in there the ng g c works fine. The also don't have the defaultProject field in the angular.json.

    I am doing so comparing to see what is different in the rest of the file.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think that is becuase a default Angular project creates a folder with the projetc name but ASP.NET Zero's angular version doesn't have this folder. We will consider creating this folder but we need to be sure we will handle breaking changes smoothly.

  • User Avatar
    0
    [email protected] created

    Actually, I found the issue.

    In angular.json, you guys define two projects.

    abp-zero-template and abp-zero-template-e2e

    So, it makes sense now that the defaultProject is not being defined it does not know which project to choose when creating components. So now you must pass the flag --project to tell the cli which project to use. I don't see where that second project is being used anymore. If it's for protactor, that is deprecated so maybe that can be removed?

    Protractor is deprecated and will reach end-of-life in August 2023.

  • User Avatar
    0
    ismcagdas created
    Support Team

    You are probalby right, I have reopened the issue and we will work on this. Since we are already using Playwright for the UI tests, I tihnk it will be OK to remove abp-zero-template-e2e project.