Skip to content

npm init @knip/config fails on SVN repository #752

Closed
@guillaumebrunerie

Description

@guillaumebrunerie

Reproduction url

N/A

Description of the issue

Running npm init @knip/config on an svn repository fails hard. It should either not fail, or fail with a clearer error message ("@knip/config only supports git repositories") and in that case be explained in the docs.

$ npm init @knip/config                                                                                                                                                                                                        [16:09]
Need to install the following packages:
@knip/[email protected]
Ok to proceed? (y)


> [email protected] npx
> create-config

fatal: not a git repository (or any of the parent directories): .git
node:internal/errors:984
  const err = new Error(message);
              ^

Error: Command failed: git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at getPackageManager (file:///Users/guillaumeb/.npm/_npx/017255d4efcf138c/node_modules/@knip/create-config/index.js:14:26)
    at main (file:///Users/guillaumeb/.npm/_npx/017255d4efcf138c/node_modules/@knip/create-config/index.js:28:14)
    at file:///Users/guillaumeb/.npm/_npx/017255d4efcf138c/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:323:24)
    at async loadESM (node:internal/process/esm_loader:28:7) {
  status: 128,
  signal: null,
  output: [
    null,
    Buffer(0) [Uint8Array] [],
    Buffer(69) [Uint8Array] [
      102,  97, 116,  97, 108,  58,  32, 110, 111, 116,  32,
       97,  32, 103, 105, 116,  32, 114, 101, 112, 111, 115,
      105, 116, 111, 114, 121,  32,  40, 111, 114,  32,  97,
      110, 121,  32, 111, 102,  32, 116, 104, 101,  32, 112,
       97, 114, 101, 110, 116,  32, 100, 105, 114, 101,  99,
      116, 111, 114, 105, 101, 115,  41,  58,  32,  46, 103,
      105, 116,  10
    ]
  ],
  pid: 20595,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(69) [Uint8Array] [
    102,  97, 116,  97, 108,  58,  32, 110, 111, 116,  32,
     97,  32, 103, 105, 116,  32, 114, 101, 112, 111, 115,
    105, 116, 111, 114, 121,  32,  40, 111, 114,  32,  97,
    110, 121,  32, 111, 102,  32, 116, 104, 101,  32, 112,
     97, 114, 101, 110, 116,  32, 100, 105, 114, 101,  99,
    116, 111, 114, 105, 101, 115,  41,  58,  32,  46, 103,
    105, 116,  10
  ]
}

Node.js v21.6.1
npm error code 1
npm error path [...]
npm error command failed
npm error command sh -c create-config
npm error A complete log of this run can be found in: /Users/guillaumeb/.npm/_logs/2024-08-09T14_09_47_027Z-debug-0.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions