nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.23k stars 2.31k forks source link

Could not find any generators named "mv" on v19.6.1 #27529

Open alexandr2110pro opened 3 weeks ago

alexandr2110pro commented 3 weeks ago

Current Behavior

➜ nx g move --project=foo --destination=new/path/foo          

 NX   Could not find any generators named "move"

Expected Behavior

It should figure out that it should use @nx/workspace:move automatically, as it used to do before.

GitHub Repo

No response

Steps to Reproduce

  1. Create a workspace with Nx v19.6.1
  2. Create a lib
  3. Try to move the lib with nx g mv

Nx Report

Node           : 20.16.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.7.1

nx                 : 19.6.1
@nx/js             : 19.6.1
@nx/jest           : 19.6.1
@nx/linter         : 19.6.1
@nx/eslint         : 19.6.1
@nx/workspace      : 19.6.1
@nx/devkit         : 19.6.1
@nx/eslint-plugin  : 19.6.1
@nx/rollup         : 19.6.1
@nrwl/tao          : 19.6.1
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/rollup/plugin
@nx/eslint/plugin
@nx/jest/plugin


### Failure Logs

_No response_

### Package Manager Version

9.7.1

### Operating System

- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)

### Additional Information

Can it be because of the pnpm v9? 
ghost commented 3 weeks ago

@alexandr2110pro I am checking if I am gonna face the same issue with npm manager. If so, I will try to fix it.

ghost commented 3 weeks ago

Hmmm @alexandr2110pro I cannot reproduce the issue. My setup is:

nx report

 NX   Report complete - copy this into the issue template

Node           : 20.12.1
OS             : win32-x64
Native Target  : x86_64-windows
pnpm           : 9.7.1

nx                 : 19.6.1
@nx/js             : 19.6.1
@nx/jest           : 19.6.1
@nx/eslint         : 19.6.1
@nx/workspace      : 19.6.1
@nx/angular        : 19.6.1
@nx/devkit         : 19.6.1
@nx/eslint-plugin  : 19.6.1
@nx/playwright     : 19.6.1
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@ngrx/eslint-plugin : 18.0.2
@ngrx/signals       : 18.0.2
@ngrx/store         : 18.0.2

And it works

ghost commented 3 weeks ago

@alexandr2110pro Maybe this is releted to your OS?

If you could debug it a little bit more:

in this file: node_modules/nx/src/command-line/generate/generate.js near line number 80 put console.log like this:

    if (choicesFromLocalPlugins.length) {
        choicesFromLocalPlugins[choicesFromLocalPlugins.length - 1].message += '\n';
    }
    console.log('deprecatedChoices', deprecatedChoices);
    console.log('choicesFromLocalPlugins', choicesFromLocalPlugins);
    console.log('choicesMap', choicesMap);
    const choices = choicesFromLocalPlugins.concat(...choicesMap);
    if (choices.length === 1) {
        return typeof choices[0] === 'string' ? choices[0] : choices[0].value;
    }
    else if (!interactive && choices.length > 1) {
        throwInvalidInvocation(Array.from(choicesMap));
    }
ghost commented 3 weeks ago

Have you tries to clean-up the repo? nx reset or just remove .nx folder

FrozenPandaz commented 3 weeks ago

Could you please provide a repo where this occurs? This is working fine here in the nx repo.

alexandr2110pro commented 3 weeks ago

Hey there. It turned out the @nx/workspace package wasn't installed. I don't know why—I think I've used Nx generators only to create a monorepo and all the libraries in it. I believe previously, when you did it like that, it used to install the workspace package.

The problem went away when I installed it.

alexandr2110pro commented 3 weeks ago

What is more interesting, that nx report printed the @nx/workspace but it wasn't in the package.json

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏