add-nx-to-monorepo fails with confusing error for minimal package.json
See original GitHub issueI 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:
- Created a year ago
- Reactions:9
- Comments:5
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I found a little trick : npx add-nx-to-monorepo --yes no
But no task runner configuration was generated…
Thanks @DRenaud, that workaround also worked with
yarn dlx nx@latest init --yes no