Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid projects error when running lerna command after updating nx #13153

Closed
Robloche opened this issue Nov 14, 2022 · 5 comments · Fixed by #13206
Closed

Invalid projects error when running lerna command after updating nx #13153

Robloche opened this issue Nov 14, 2022 · 5 comments · Fixed by #13206

Comments

@Robloche
Copy link

Current Behavior

I'm using lerna 6.0.3 to run commands accross all packages of my monorepo.
Until nx 15.0.10, everything was fine but starting from version 15.0.11, it stopped working.
Every lerna command I try causes the same error:

$ npx lerna run lint
lerna notice cli v6.0.3
lerna ERR! Error: Invalid projects: @my/project1, @my/project2, @my/project3, @my/project4
lerna ERR!     at checkForInvalidProjects (C:\xxx\node_modules\nx\src\command-line\run-many.js:45:15)
lerna ERR!     at projectsToRun (C:\xxx\node_modules\nx\src\command-line\run-many.js:38:5)
lerna ERR!     at C:\xxx\node_modules\nx\src\command-line\run-many.js:23:26
lerna ERR!     at Generator.next (<anonymous>)
lerna ERR!     at fulfilled (C:\xxx\node_modules\tslib\tslib.js:115:62)
lerna ERR! lerna Invalid projects: @my/project1, @my/project2, @my/project3, @my/project4

Expected Behavior

If I revert to nx 15.0.10, my lint script is correctly executed on all my packages.

Steps to Reproduce

I don't know if it's a pure nx issue or a mix of nx and lerna.
Maybe it has something to do with my naming: @my/project...
If nobody has any idea, I can try to build a small repo to reproduce the issue.

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 16.13.1
   OS   : win32 x64
   npm  : 8.18.0

   nx : 15.0.13
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.0.13
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : Not Found
   @nrwl/js : Not Found
   @nrwl/linter : Not Found
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 15.0.2
   @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 : Not Found
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         lerna: 6.0.3
@AgentEnder
Copy link
Member

Can you run nx graph and compare the project names to what you expect?

Also, if you can create a reproduction that would be really helpful. This is most likely coming from the Nx + Lerna combo, but it should be supported.

@Robloche
Copy link
Author

Version 15.0.10 shows me all my packages, with the correct names and relationships.
Version 15.0.13 doesn't show any packages. Blank screen...

I'm gonna try to reproduce my issue in a smaller repo. I'll let you know.

@Robloche
Copy link
Author

OK. I created a small monorepo which reproduces the issue.
You can find it here: https://github.com/Robloche/nx-lerna-issue

With nx v15.0.10:

$ npm run test

> test
> npx lerna run test

lerna notice cli v6.0.3

    √  @my/project2:test (1s)
    √  @my/project1:test (1s)

 —————————————————————————————————————————————————————————————————————————————————————————————
 
 >  Lerna (powered by Nx)   Successfully ran target test for 2 projects (1s)

With nx v15.0.13:

$ npm run test

> test
> npx lerna run test

lerna notice cli v6.0.3
lerna ERR! Error: Invalid projects: @my/project1, @my/project2
lerna ERR!     at checkForInvalidProjects (C:\Code\nx-lerna-issue\node_modules\nx\src\command-line\run-many.js:45:15)
lerna ERR!     at projectsToRun (C:\Code\nx-lerna-issue\node_modules\nx\src\command-line\run-many.js:38:5)
lerna ERR!     at C:\Code\nx-lerna-issue\node_modules\nx\src\command-line\run-many.js:23:26
lerna ERR!     at Generator.next (<anonymous>)
lerna ERR!     at fulfilled (C:\Code\nx-lerna-issue\node_modules\tslib\tslib.js:115:62)
lerna ERR! lerna Invalid projects: @my/project1, @my/project2

@FrozenPandaz
Copy link
Collaborator

Thank you for the reproduction! That made it much easier to find the issue.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants