Closed markosankovic closed 2 years ago
@markosankovic - Project names must be unique across apps and libs. In the example in the documentation page you linked, there's no library that actually has the same name as the application. There are several libs that are grouped under a directory that has the same name of the application, though. We refer to that directory as a grouping directory.
In your reproduction code, you'd do something like this to replicate the example in the documentation:
create-nx-workspace --preset=angular --name=acme --appName=detonator --style=css --nx-cloud=false
cd acme
nx generate @nrwl/angular:library --name=detonator/feature-main
This will create your app named detonator
and then create a lib called detonator-feature-main
. It will be created in the libs/detonator/feature-main
directory.
Hopefully that clarifies things. If you have any more feedback, let us know what changes we could make to the docs to make this clearer.
@philipjfulcher thanks for the explanation. I'll just create a feature library in the grouping directory named same as the app, just as you suggested. My mistake, sorry.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
"Error: Project name already exists." is reported by the nx generator (Angular) when trying to generate a library with the same name as an existing app. The recommended directory structure is to use the same name for both app and lib, see: https://nx.dev/l/a/guides/monorepo-nx-enterprise#scope-where-a-library-lives-who-owns-it (happynrwlapp).
Expected Behavior
The nx generator should let me create library with the same name as an existing app. Not sure if this is possible since the error comes from the Angular schematics.
Steps to Reproduce
Failure Logs
Environment