knip icon indicating copy to clipboard operation
knip copied to clipboard

🐛 Cannot run `yarn create @knip/config` in monorepo root

Open julianCast opened this issue 11 months ago • 3 comments

Prerequisites

Description of the issue

Related to https://github.com/webpro-nl/knip/issues/724 but with yarn

Running: yarn create @knip/config

Getting same issue but even with -W param now.

node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: yarn add -W -D knip typescript @types/node
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:888:11)
    at execSync (node:child_process:960:15)
    at main (file:///private/var/folders/7t/x_27lndd5lz_qt50v0jfdygc0000gn/T/xfs-107abe5b/dlx-5250/node_modules/@knip/create-config/index.js:44:3)
    at file:///private/var/folders/7t/x_27lndd5lz_qt50v0jfdygc0000gn/T/xfs-107abe5b/dlx-5250/node_modules/@knip/create-config/index.js:53:1
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(233) [Uint8Array] [
       27,  91,  51,  49, 109,  27,  91,  49, 109,  85, 110, 107,
      110, 111, 119, 110,  32,  83, 121, 110, 116,  97, 120,  32,
       69, 114, 114, 111, 114,  27,  91,  50,  50, 109,  27,  91,
       51,  57, 109,  58,  32,  85, 110, 115, 117, 112, 112, 111,
      114, 116, 101, 100,  32, 111, 112, 116, 105, 111, 110,  32,
      110,  97, 109, 101,  32,  40,  34,  45,  87,  34,  41,  46,
       10,  10,  36,  32, 121,  97, 114, 110,  32,  97, 100, 100,
       32,  91,  45,  45, 106, 115, 111, 110,  93,  32,  91,  45,
       69,  44,  45,  45,
      ... 133 more items
    ],
    Buffer(0) [Uint8Array] []
  ],
  pid: 5255,
  stdout: Buffer(233) [Uint8Array] [
     27,  91,  51,  49, 109,  27,  91,  49, 109,  85, 110, 107,
    110, 111, 119, 110,  32,  83, 121, 110, 116,  97, 120,  32,
     69, 114, 114, 111, 114,  27,  91,  50,  50, 109,  27,  91,
     51,  57, 109,  58,  32,  85, 110, 115, 117, 112, 112, 111,
    114, 116, 101, 100,  32, 111, 112, 116, 105, 111, 110,  32,
    110,  97, 109, 101,  32,  40,  34,  45,  87,  34,  41,  46,
     10,  10,  36,  32, 121,  97, 114, 110,  32,  97, 100, 100,
     32,  91,  45,  45, 106, 115, 111, 110,  93,  32,  91,  45,
     69,  44,  45,  45,
    ... 133 more items
  ],
  stderr: Buffer(0) [Uint8Array] []
}

Node.js v22.11.0

julianCast avatar Dec 26 '24 11:12 julianCast

Thanks for the report, @julianCast. Would you be up for creating a pull request?

webpro avatar Jan 04 '25 07:01 webpro

Thanks for the report, @julianCast. Would you be up for creating a pull request?

I can give it a try as soon as I have time, thanks!

julianCast avatar Jan 08 '25 08:01 julianCast

Similar issue for npm with workspaces

node:internal/errors:865
  const err = new Error(message);
              ^

Error: Command failed: npm add -D knip typescript @types/node
npm warn idealTree Removing dependencies.typescript in favor of devDependencies.typescript
npm error code ERESOLVE
npm error ERESOLVE could not resolve

nikolay-borzov avatar Feb 26 '25 13:02 nikolay-borzov

I think this is fixed by now (v1.0.5)

Also see https://github.com/webpro-nl/knip/commits/main/packages/create-config/index.js

Please let me know if there's still any issues.

webpro avatar Apr 09 '25 19:04 webpro