nx: Nx 8.4.x workspaces don't have angular.json file
I see that release 8.4.0 stopped adding an angular.json file after creating an empty workspace with npx create-nx-workspace myworkspace. This appears correct if Nx is moving to a generic monorepo workspace for web development and an empty workspace was selected when creating the workspace. However, after running yarn add @nrwl/angular and then run ng g @nrwl/angular:application myapp I get the following error

Also, nx.json file still has angular.json under implicitDependencies with the empty workspace.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 15 (5 by maintainers)
I’ve started getting into nx-workspace and noticed a lack of information about which cli to use. I thing it’s a big issue when getting started and first prompt you get while creating an nx-workspace is the option to use nx - or ng cli and no documentation to be found explaining the pros and cons. If my intention is to build angular apps, but not exclusively, side by side with react, web, etc.: what’s best choice? Good spot to target the issue would be https://nx.dev/angular/getting-started/nx-and-cli. Does the usage of the ng-cli limit workspace capability? Does “nx g @nrwl/angular:foobar” the same job as “ng g foobar”, just with the difference of naming the config file angular - or workspace.config. Confusion is complete when reading/watching tutorials where nx-cli is used for angular app development not mentioning why this decision was made and ng-console turns out to be nx-console now. Does nx-console support the use of ng-cli powered by nrwl schematics and builders? Some documentation about pros and cons in under which context would be very helpful!
@ahnpnl if you’re primarily using Angular, you should be using the
ngcommands like they are in the Angular tutorial. If you’re primarily using React or Web Components, you should be using thenxcommands. The difference is that there is only aworkspace.jsonwhen primarily only using React or Web Components. Thenxcommand delegates appropriately, but we could define this more clearly in the docs for the Nx CLI here: https://nx.dev/react/guides/cliI ran into this issue too. After spending some times, I figured out if generating workspace and choosing Nx CLI, there will be a
workspace.jsonand if choosing Angular CLI, there will be aangular.json. I didn’t see this stating in the documentation.@vsavkin another thing I noticed is the tutorial for Angular doesn’t cover the
nxcommands if users generate workspace choosing Nx CLI.So, is there an easy way to convert from one to the other? Is it as simple as renaming the files (
angular.json<=>workspace.json) and updating theimplecentDependenciesin thenx.jsonfileOr is there more to it?
@vsavkin, is there a way to generate angular.json on an existing project?
@tthrash since you selected Nx as the CLI when generating a workspace, the workspace only works with the nx cli. So there is no
@angular/cliand the Ng command does not work.If you select
Angular CLI, you will get an angular cli workspace, and the ng command will work.If you select angular or angular-nest preset, we automatically select the Angular CLI for you. But when you create an empty workspace, we don’t know if you intend to use it for angular or not.
I’m going to add a warning message when you add nrwl/angular to an empty workspace, to indicate that the workspace you create is not an angular cli workspace.
Closing this issue.
I created a new nx workspace with preset angular and added a demo app. However mine angular.json is not having configurations where can I find them.
Below are the entries in angular.json
{ “$schema”: “./node_modules/nx/schemas/workspace-schema.json”, “version”: 2, “projects”: { “demo”: “apps/demo”, “demo-e2e”: “apps/demo-e2e” } }
If I create a new nx workspace without presets, then add ng apps to it, the cli doesn’t generate an angular.json file. Where would one add ui libraries like primeng, normalize.css, etc to an nx workspace? Normally those things would be added to the angular.json file.
@tthrash
Thank you!