How to generate .angular-cli.json file in Angular Cli?

前端 未结 9 2226
情深已故
情深已故 2020-12-04 23:57

I have installed Angular CLI package separately using npm:

npm install --save-dev @angular/cli@latest

When I try to use commands cli<

9条回答
  •  情深已故
    2020-12-05 00:12

    I got this same error in my current project and was confused because I'm running the application / ng serve in one terminal, but got this when I tried to generate a component from another terminal. .angular-cli.json was already there and correct. So what gives?

    I realized that I used the shortcut to open VisualStudio Code's internal terminal -- which opened the terminal to the *root of the project * (like most IDEs). The project contains other things in addition to the Angular application folder that has the .angular-cli.json file in question. I just had to cd to the right folder and run ng g c again and things were fine.

    In my case it was just a silly error. I thought I'd come back to share in order to save people a real headache for something so simple. I see that Shiva actually has mentioned this above, but I thought I would give a bit more detail so it doesn't get overlooked.

提交回复
热议问题