webpro-nl/knip

Cannot run yarn create @knip/config in workspaces root

Closed this issue · 1 comments

Reproduction url

https://github.com/itdhsc/repro-knit-yarn-workspaces

Description of the issue

I was running yarn create @knip/config in my yarn workspaces monorepo root but running the command fails with the following log:

error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at main (file:///Users/hsc/.config/yarn/global/node_modules/@knip/create-config/index.js:35:3)
    at file:///Users/hsc/.config/yarn/global/node_modules/@knip/create-config/index.js:44:1
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12) {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(951) [Uint8Array] [
      121,  97, 114, 110,  32,  97, 100, 100,  32, 118,  49,  46,
       50,  50,  46,  50,  50,  10,  36,  32,  99, 100,  32,  46,
       46,  47, 109, 105,  99, 114, 111, 102, 114, 111, 110, 116,
      101, 110, 100,  45, 119, 114,  97, 112, 112, 101, 114,  32,
       38,  38,  32, 121,  97, 114, 110,  32, 105, 110, 115, 116,
       97, 108, 108,  32,  38,  38,  32, 121,  97, 114, 110,  32,
       98, 117, 105, 108, 100,  32,  38,  38,  32,  99, 100,  32,
       46,  46,  47, 109, 105,  99, 114, 111, 102, 114, 111, 110,
      116, 101, 110, 100,
      ... 851 more items
    ],

[...]

A similar issue was fixed recently with issue #724 — maybe the same reason but just for yarn workspaces?

Yeah that sounds like the same issue indeed. Would you like to send a PR?