nx icon indicating copy to clipboard operation
nx copied to clipboard

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

Open alexandr2110pro opened this issue 1 year ago • 7 comments
trafficstars

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? 

alexandr2110pro avatar Aug 20 '24 08:08 alexandr2110pro

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

ghost avatar Aug 20 '24 18:08 ghost

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 avatar Aug 20 '24 19:08 ghost

@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 avatar Aug 20 '24 19:08 ghost

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

ghost avatar Aug 20 '24 19:08 ghost

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

FrozenPandaz avatar Aug 23 '24 21:08 FrozenPandaz

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 avatar Aug 25 '24 11:08 alexandr2110pro

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

alexandr2110pro avatar Aug 25 '24 11:08 alexandr2110pro

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! 🙏

github-actions[bot] avatar Sep 02 '24 00:09 github-actions[bot]

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[bot] avatar Oct 24 '24 00:10 github-actions[bot]