#use of typescript third party libraries

1 messages · Page 1 of 1 (latest)

low hornet
#

I would like to use a library called simpleGit (5 millions download)

so I do yarn add simple-git
then I write the following function:

  import { simpleGit } from 'simple-git';

  @func()
  async cloneRepo(): Promise<string> {
    const whatever: string = await simpleGit()
      .clone("https://github.com/steveukx/git-js.git")
    return whatever
  }

then I do dagger call clone-repo

and then I get the error:

1   : clone-repo
90  : │ first DONE [2.1s]

92  : First.cloneRepo: String!
92  : [1.6s] | Error: Error: spawn git ENOENT
92  : [1.6s] |     at ChildProcess._handle.onexit (node:internal/child_process:285:19)
92  : [1.6s] |     at onErrorNT (node:internal/child_process:483:16)
92  : [1.6s] |     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
92  : First.cloneRepo ERROR [1.6s]
92  : ! process "tsx --no-deprecation --tsconfig /src/first/tsconfig.json /src/first/src/__dagger.entrypoint.ts" did not complete successfully: exit code: 1

1   : clone-repo
1   : [14.3s] | Error: input: first.cloneRepo process "tsx --no-deprecation --tsconfig /src/first/tsconfig.json /src/first/src/__dagger.entrypoint.ts" did not complete successfully: exit code: 1
1   : [14.3s] | 
1   : [14.3s] | Stderr:
1   : [14.3s] | Error: Error: spawn git ENOENT
1   : [14.3s] |     at ChildProcess._handle.onexit (node:internal/child_process:285:19)
1   : [14.3s] |     at onErrorNT (node:internal/child_process:483:16)
1   : [14.3s] |     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
1   : clone-repo ERROR [14.3s]
1   : ! exit code 1
  1. why do I get an error ? (did I do something really wrong)
  2. how can I fix this ? (I just want to use a third party library, I am pretty sure I could clone with direct functions from dagger but that is not the purpose of this question)
  3. how to get more easier to understand error logs that will explain what actually went wrong ?
night rover
#

👋 hi!

The error Error: spawn git ENOENT sounds like that library depends on the runtime having access to the git binary, which I guess the sandbox does not have. Is that right @orchid coyote ?

low hornet
#

@night rover thank you. Can you tell me how I can modify/switch the sandbox so it would get access to git ?

hollow egret