Setting `workspace.json` causes nx to look at `project.json`
See original GitHub issueCurrent Behavior
I installed a new nx monorepo, using the configurations in package.json
as explained here.
My packages contain a property nx
inside the package.json
.
As explained here, the creation of workspace.json
is optional but possible with the package.json
approach instead of the project.json
one.
However, when I add a workspace.json
inside the root, every command that I try to run fails with the error:
ENOENT: no such file or directory, open '/Users/lughino/project/packages/package-a/project.json'
When I remove the workspace.json
file, everything comes back to work normally.
I guess when the workspace file is found, nx just looks for the project.json
inside each package.
Expected Behavior
Either be able to set workspace.json
and use the configuration through package.json
or remove from this documentation the section related to setting workspace.json
.
Steps to Reproduce
- In any nx monorepo add the
workspace.json
in the root - ensure to not have
project.json
file inside the packages - run any command, like
nx build package-a
Failure Logs
ENOENT: no such file or directory, open '/Users/lughino/project/packages/package-a/project.json'
Environment
> NX Report complete - copy this into the issue template
Node : 16.13.0
OS : darwin x64
yarn : 1.22.17
nx : 13.7.3
@nrwl/angular : undefined
@nrwl/cli : 13.7.3
@nrwl/cypress : undefined
@nrwl/detox : undefined
@nrwl/devkit : 13.7.3
@nrwl/eslint-plugin-nx : 13.7.3
@nrwl/express : undefined
@nrwl/jest : 13.7.3
@nrwl/js : undefined
@nrwl/linter : 13.7.3
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : undefined
@nrwl/tao : 13.7.3
@nrwl/web : undefined
@nrwl/workspace : 13.7.3
typescript : 4.5.5
rxjs : 6.6.7
---------------------------------------
Community plugins:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:8 (2 by maintainers)
Top Results From Across the Web
workspace.json - Nx
Identified the locations of all project in the repo; Contained the target configuration for all projects. Identifying the locations of projects is now...
Read more >Setup a Monorepo with PNPM workspaces and speed it up ...
In this article we're going to have a deep dive into setting up a new monorepo using PNPM workspaces that hosts a Remix...
Read more >@jscutlery/semver - npm
Setup. Install. Using Nx: npm install -D @jscutlery/semver nx g @jscutlery/semver: ... Bump package.json version based on the commits.
Read more >Angular.json Invalid in Nx Workspace - Stack Overflow
I recently migrated a usual Angular Application into an Nx Workspace. Badly, I always get an error when trying to run any command...
Read more >nrwl-nx/community - Gitter
const projects = readJsonInTree(host, 'workspace.json').projects; ... I can't seem to be able to require the any libs (always get the cannot find module)....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
the issue is that the documentation is not clear enough on the nuanced and magical side effects caused by the presence of these files.
Usually documentation challenges like these means that surprising behaviour is hidden in densely wrapped paragraphs of information.
@FrozenPandaz this is working as intended based on when the project inference capabilities were added, if you think it should be expanded to work from package.json as well it would not be terribly hard to add the capability.
LMK what you think, I can implement.