DEV Community

Muhammad Ahsan Ayaz
Muhammad Ahsan Ayaz

Posted on

How to add Angular to an existing empty NX workspace

Well, this article is about...what the title says :D
I was trying to find this over the internet and couldn't find an easy answer. But with the amazing SEO of, I'm really confident that people searching for the same can easily find how to do it.


If you have an empty NX repository, i.e. not created with the angular preset, you can't run the following command to create an Angular app:

ng generate app myApp
Enter fullscreen mode Exit fullscreen mode

That's because you'll probably get this error:
Image description

And what it means is that we can't really run ng commands unless we have the angular.json file present in the project's root folder and Angular is already set up. Ergo, we can't add Angular to this empty NX repository this way.


You need to install the @nrwl/angular package into the repository as follows:

npm install --save-dev @nrwl/angular
yarn add -D @nrwl/angular
Enter fullscreen mode Exit fullscreen mode

Now you can run the following command to generate an Angular app within the repo. This will also configure the nx workspace to be able to work with Angular apps/libraries.

nx g @nrwl/angular:application myApp
Enter fullscreen mode Exit fullscreen mode

Thank me later :D


If you found the article useful, make sure to hit the like or the bookmark icon. Check out my YouTube Channel for more amazing content. And if you feel adventurous and are interested in taking your #Angular skills to the next level, check out the Angular Cookbook. It's awesome!

Top comments (0)