Search code examples
angularnativescriptangular2-nativescript

Angular-cli component generator do not work inside Nativesctipt


I'm trying to learn Angular with Nativescript.

So, I installed angular-cli and nativescript on my windows 10 machine.

Angular works fine by itself but when I want to generate component inside nativescript project, I have this error:

compare of angular with nativescript while generating component

After a couple of times of research, I installed @nativescript/schematics from THIS SOURCE:

npm i -g @angular/cli

npm i -g @nativescript/schematics "tested with -D either"

And after that I have this error:

stack trace after install schematics

Do you know what's my problem and how to solve this?

Thanks in Advance


Solution

  • I'm not sure why someone gave me -1;

    There's still some extra command needed-for me on windows 10 and tested on mac- to work with:

    ng g c some-component

    inside nativescript-angular project.

    These steps fixed my problem :

    1. tns create angularProject

    2. npm i -D @nativescript/schematics

    3. npm i @angular-devkit/schematics @angular-devkit/core @schematics/angular

    and then you can simply use : ng g c some-component

    My tns version is 6.8.0 and my angular-cli version is 10.0.4 when I'm writing this answer.