Nx: angular.json missing from new workspace (react) - causes error runing NG

Created on 27 Jul 2019  Â·  5Comments  Â·  Source: nrwl/nx

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

To be able to add applications to a newly created workspace.

Current Behavior

Following the docs for creating a new workspace and then trying to add a react app. Creating a new workspace DOES NOT create a angular.json file so trying to run NG always fails

Failure Information (for bugs)

➜  typescript npx create-nx-workspace testfinal
npx: installed 166 in 10.678s
? What to create in the new workspace empty             [an empty workspace]
    Successfully initialized git.
CREATE testfinal/nx.json (202 bytes)
CREATE testfinal/tsconfig.json (509 bytes)
CREATE testfinal/README.md (2541 bytes)
CREATE testfinal/.editorconfig (245 bytes)
CREATE testfinal/.gitignore (503 bytes)
CREATE testfinal/.prettierignore (57 bytes)
CREATE testfinal/.prettierrc (26 bytes)
CREATE testfinal/workspace.json (96 bytes)
CREATE testfinal/package.json (1045 bytes)
CREATE testfinal/apps/.gitkeep (1 bytes)
CREATE testfinal/libs/.gitkeep (0 bytes)
CREATE testfinal/tools/tsconfig.tools.json (218 bytes)
CREATE testfinal/tools/schematics/.gitkeep (0 bytes)
CREATE testfinal/.vscode/extensions.json (109 bytes)

Notice above there is NO angular.json

so... this fails ....

➜  testfinal git:(master) ng add @nrwl/react
The add command requires to be run in an Angular project, but a project definition could not be found.

Also the angular console app fails as well, I think its also becasue the angular.json is missing see
https://github.com/nrwl/angular-console/issues/779

Steps to Reproduce

See above for steps.

Context

Please provide any relevant information about your setup:

  • version of Nx latest
  • version of Angular CLI latest
  • angular.json configuration ITS MISSING
question / discussion

Most helpful comment

@appsolutegeek

8.4+ supports two CLIs: Angular CLI and Nx CLI. It works as follows:

  • if you select an empty preset, you have to select the CLI
  • if you select a preset with an angular app, you get the angular cli
  • if you select a preset without an angular app, you get the nx cli

I tried to make this process clearer in 8.4.3. Could you give it a try to see if it's transparent enough?

All 5 comments

The way I got around this was to create an angular app with NX and then i was able to add a react app as the angular.json already exists.

I then removed the angular app from nx.json and also angular.json

Is this the correct workaround ?

Ok, it seems that a react app doesn't create an angular.json but it creates a workspace.json

So all commands now are NX instead of NG.

Do you have a list of a comparison between NX and NG ?

This must be something new :-) ? As I never saw this before.

@appsolutegeek

8.4+ supports two CLIs: Angular CLI and Nx CLI. It works as follows:

  • if you select an empty preset, you have to select the CLI
  • if you select a preset with an angular app, you get the angular cli
  • if you select a preset without an angular app, you get the nx cli

I tried to make this process clearer in 8.4.3. Could you give it a try to see if it's transparent enough?

Ok thank you, made a note. Thank you

If I'm using nx cli isn't a way to setup an angular.json ? also Angular Console capabilities are lost

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IonFoXx picture IonFoXx  Â·  3Comments

joelmuskwe picture joelmuskwe  Â·  3Comments

jon301 picture jon301  Â·  3Comments

jasedwards picture jasedwards  Â·  3Comments

zpydee picture zpydee  Â·  3Comments