question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local workspace-generator does not work after update to nx@15.0.0

See original GitHub issue

Current Behavior

npx nx workspace-generator <name> <options> fails with

Not enough non-option arguments: got 0, need at least 1

The error happens due to a recent change in nx, where (option) is appended to the command if there are options specified.

Converting https://github.com/nrwl/nx/blob/master/packages/nx/src/command-line/nx-commands.ts#L841 from if(options.length) to if(!options.length) seems to fix the issue. I can try creating a PR if that helps.

Expected Behavior

npx nx workspace-generator <name> <options> should launch the generator and generate the required code.

Steps to Reproduce

Reproduction in https://github.com/bridzius/workspace-generator-repro Clone, npm ci, run npx nx workspace-generator generato --all. Should run the generator, but fails with said error.

Failure Logs

npx nx workspace-generator generato --all
nx workspace-generator generato [name] (options)

Positionals:
  name  Library name                                                                                              [string]

Options:
  --help     Show help                                                                                           [boolean]
  --version  Show version number                                                                                 [boolean]
  --all      All for testing                                                                                     [boolean]

Find more information and examples at https://nx.dev/nx/workspace-generator

Not enough non-option arguments: got 0, need at least 1

Environment

   Node : 16.17.1
   OS   : darwin arm64
   npm  : 8.15.0
   nx : 15.0.0
   @nrwl/angular : 15.0.0
   @nrwl/cypress : 15.0.0
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.0.0
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.0.0
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.0.0
   @nrwl/js : 15.0.0
   @nrwl/linter : 15.0.0
   @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 : 15.0.0
   @nrwl/web : Not Found
   @nrwl/webpack : 15.0.0
   @nrwl/workspace : 15.0.0
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Roozenboomcommented, Oct 25, 2022

We have exactly the same error after upgrading to NX 15.0.1 (from 14.8.2) and after removing the following lines from packages/nx/src/command-line/nx-commands.ts L842 it worked again.

if (options.length) {
    command += ' (options)';
}

We also have another issue with local workspace-generators that has no properties object in the schema.json, because of missing error handling it throws the following error: TypeError: Cannot convert undefined or null to object for Object.entries(schema.properties).forEach(([name, prop]) => { as a workaround I can add an empty properties object to each schema.json but this can be fixed by checking if the property exists on packages/nx/src/command-line/nx-commands.ts L814.

I am happy to raise a pull request for both issues.

3reactions
Hotellcommented, Oct 20, 2022

Workspace generators is configured by default to require a name.

Would you mind to elaborate more on this one @FrozenPandaz ? There is no mention of such a thing in docs nor release changelog.

Anyways workspace generator execution is indeed broken in nx 15 (it has nothing to do with missing name ).

image

Last workable state Nx 14.8.4 (its broken since 14.8.5 -> https://github.com/nrwl/nx/pull/12258)

ping @meeroslav

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new in Nx 15?. Nx v15 is finally here! Let's go… - Nx Blog
To share and link packages locally within the monorepo, the "workspaces" feature from NPM/Yarn/PNPM can be used. Tools for this style are Nx,...
Read more >
Compute_Special_Issue_1988_...
If you don't see the file you're looking for, tum the disk over and repeat the process on the other side. In most...
Read more >
Untitled
Magnani sposa vigasio, Amsm makedonija testovi, Sitemap priority 0.0, ... Decoder sd18a, Js error is not a function, Urs peter koller, Windsim 6.0, ......
Read more >
Your Computer
your work and do not send us oe-yinoi artwor*. ... will be updated on a regular ... As new computing products become more...
Read more >
Byte Oct 1988 - Vintage Apple
that does it all; nothing is half done or not done at all-instead, ... UPGRADE OFFERS For registered Turbo Pascal* and Turbo c•...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found