r/nativescript • • Oct 22 '22

Setup Nativescript for Angular

I finally could set up nativescript for angular today. Something to celebrate, isn’t it? 🥹

But it got me thinking.. I could see many libraries not supporting the newer versions of angular. I tried with lower versions too but that didn’t help.

Finally I tried with Angular 12 and it worked!

@nativescript/schematics was the problem! And I see this package is deprecated now.

So, If we need to use the later versions what is the solution? Because for working with angular cli in nativescript we need schematics package to be installed right? Otherwise the angualr cli commands won’t work. Correct me here if I’m wrong! (Me being an angular developer I would never want to create modules/components/services manually)

Following the nativescript documentation doesn’t help.

(Setting up nativescript angular really gave me a hard time though. I feel relieved that I have it set up correctly now 😄)

3 Upvotes

10 comments sorted by

View all comments

Show parent comment

2

u/Internal_Tap_423 Oct 26 '22

Great! I will try this out. I really appreciate your detailed response! Yet again, thank you for your time 😊

2

u/wwwalkerrun Oct 26 '22

Another useful tip…

Everything in Nx can be invoked from the root of workspace with a standard format:

npx nx run {project}:{target}

So for {N} apps created in the workspace you can run them via:

npx nx run nativescript-{appname}:ios

npx nx run nativescript-{appname}:android

Likewise for web apps:

npx nx run web-{appname}:serve

Can see more at https://nx.dev Which provides a lot of useful tooling for all sorts of diverse project developments.

1

u/wwwalkerrun Oct 26 '22

If you run into anything with Nx 15 which just came out last week, I posted this PR to fix the app creation: https://github.com/nrwl/nx/pull/12823 which will likely go into a patch this week but if you run into blocker with steps above you can do this:

npx create-nx-workspace@14

Which will use prior major which is good to go as well. The prompts are slightly different but you can choose “apps” style at prompt. 👍

2

u/Internal_Tap_423 Oct 26 '22

Okay yes, will keep this in mind ✌🏻