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.

add-nx-to-monorepo fails with confusing error for minimal package.json

See original GitHub issue

I am trying to add nx to a monorepo I am trynig to create for my python packages

  • I am using nx for the first time
  • I am trying to structure my code in a monorepo for the first time (package based monorepo)

Current Behavior

npx add-nx-to-monorepo fails with an unclear error

Expected Behavior

I was expecting it to ask some questions or at the very least tell me why it can’t ask me questions

Steps to Reproduce

The package.json I have in my python project was added mainly for commitlint

{
  "devDependencies": {
    "@commitlint/cli": "^17.0.0",
    "@commitlint/config-conventional": "^17.0.0",
    "cz-conventional-changelog": "^3.3.0"
  },
  "config": {
    "commitizen": {
      "path": "./commitizen.js"
    }
  }
}

When I try to run $ npx add-nx-to-monorepo - it fails.

Easiest way to reproduce seems to be:

$ mkdir /tmp/test_nx
$ echo '{}' > package.json
$ npx add-nx-to-monorepo

Failure Logs

$ npx add-nx-to-monorepo

 >  NX   🐳 Nx initialization


 >  NX   🧑‍🔧 Please answer the following questions about the scripts found in your workspace in order to generate task runner configuration

/home/abdealijk/.npm/_npx/dcff4b037c44fe4f/node_modules/enquirer/lib/types/array.js:38
      throw new Error('At least one choice must be selectable');
            ^

Error: At least one choice must be selectable
    at MultiSelect.reset (/home/abdealijk/.npm/_npx/dcff4b037c44fe4f/node_modules/enquirer/lib/types/array.js:38:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MultiSelect.initialize (/home/abdealijk/.npm/_npx/dcff4b037c44fe4f/node_modules/enquirer/lib/types/array.js:25:5)
    at async /home/abdealijk/.npm/_npx/dcff4b037c44fe4f/node_modules/enquirer/lib/prompt.js:236:7

Environment

I am using Ubuntu 18.04 with WSL2 on Windows 10

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:9
  • Comments:5

github_iconTop GitHub Comments

2reactions
DRenaudcommented, Nov 17, 2022

I found a little trick : npx add-nx-to-monorepo --yes no

But no task runner configuration was generated…

0reactions
nedkellycommented, Dec 2, 2022

Thanks @DRenaud, that workaround also worked with yarn dlx nx@latest init --yes no

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Error installing relative paths using workspaces #3847
The issue came from missing workspaces package.json which were dependencies of the package I was trying to install.
Read more >
Build for monorepo with private GitHub packages fails - Support
The problem was, that the local package versions matched the versions referenced in the site-1 package.json file and Netlify attempted to use ...
Read more >
The Case for Monorepos: A sane Workspace Setup (Part 2)
Learn how to setup dev tooling in a monorepo, run tasks efficiently, release multiple packages and overcome common DevOps challenges.
Read more >
pnpm/pnpm - Gitter
Hey community. I can't install any packages with pnpm , the command exits with error but no message shows up in the prompt....
Read more >
Things I wish I had known when I started JavaScript monorepo ...
Root package.json must list all monorepo packages in it's dependencies field. The reason is simple: all packages of the monorepo will be ...
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