nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

Nx can't find any projects in our repository from the 15.0.11 release #13063

Closed Will956 closed 2 years ago

Will956 commented 2 years ago

Hello ๐Ÿ‘‹

Current Behavior

We have a repository that uses Nx and our setup is set as follows:

/package-a
  package.json
/package-b
  package.json
/directory
package.json
nx.json

The root package.json does not have a workspace entry, we do not use npm workspace.

Since the release of 15.0.11, nx graph can't find any projects.

The error message from the nx print-affected command:

NX   Nx could not find any projects. Check if you need to configure workspaces in package.json or pnpm-workspace.yaml

Expected Behavior

Before that release, Nx can find our projects: package-a and package-b.

According to the error message, it looks like we have to use workspace now but I didn't find any documentation that push in that direction (but maybe I missed something).

Environment

nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : darwin x64
   npm  : 8.1.2

   nx : 15.0.12
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.8
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.8
   @nrwl/js : Not Found
   @nrwl/linter : 14.5.8
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : Not Found
   @nrwl/workspace : 14.5.8
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Thanks ๐Ÿ™

Will956 commented 2 years ago

It may be related to that changes https://github.com/nrwl/nx/commit/67e032d5cce8a18f06f4095f7f3d720653b3daf9, but I'm not sure ๐Ÿ˜„

Will956 commented 2 years ago

Hey @FrozenPandaz, thanks for the quick fix โค๏ธ But how I'm supposed to use that plugin in my project? Can't figure out what I have to do (bumping to 10.0.13 didn't fix our problem and as you added a plugin I assume I have to do something). Thanks ๐Ÿ™

Will956 commented 2 years ago

Ok, I guess I have to add plugins: ["package-json"] in my nx.json ๐Ÿ•ต๏ธ But now I get another issue:

 >  NX   unable to find tsconfig.base.json or tsconfig.json

We do not have a root tsconfig.json in our repository, there are located in each package.

EDIT If I add an empty tsconfig.json at the rool level I get:

 >  NX   Cannot find module 'package-json'

So I guess this is not the way to add plugins ๐Ÿ˜„

Will956 commented 1 year ago

Hey @FrozenPandaz, can you ๐Ÿ‘€ at this please? Or if you can send any documentation that can help us, thanks ๐Ÿ™

FrozenPandaz commented 1 year ago

Yes, a new plugin is available: nx/plugins/package-json. You can add it by adding this to nx.json:

  "plugins": [
    "nx/plugins/package-json"
  ]

What this plugin does is that it will re-enable the behavior prior to 15.0.11 find all package.json files as projects even without npm/yarn workspaces. After adding that to your workspace, the projects that showed up before should show up. Let me know if you have any issues.

Sorry for the delay. This will be documented shortly.

Will956 commented 1 year ago

Thanks @FrozenPandaz, works like a charm โค๏ธ

github-actions[bot] commented 1 year ago

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.