Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: gh: command not found when running npx create-typescript-app --base prompt --mode create #1616

Closed
3 tasks done
johnnyreilly opened this issue Aug 13, 2024 · 7 comments · May be fixed by #1617
Closed
3 tasks done
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@johnnyreilly
Copy link
Collaborator

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

I ran npx create-typescript-app --base prompt --mode create and experienced a gh: command not found error

Actual

┌  ✨ Welcome to create-typescript-app 1.67.5! ✨
│
│  ⚠️ This template is early stage, opinionated, and not endorsed by the TypeScript team. ⚠️
│  ⚠️ If any tooling it sets displeases you, you can always remove that portion manually. ⚠️
│
◇  What organization or user will the repository be under?
│  johnnyreilly
│
◇  What will the kebab-case name of the repository be?
│  test-create-repo
│
◇  ❌ Error checking GitHub authentication.
file:///Users/john.reilly/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/shared/cli/spinners.js:16
    throw new Error(`Failed ${lowerFirst(label)}`, { cause: error });
          ^

Error: Failed checking GitHub authentication
    at withSpinner (file:///Users/john.reilly/.npm/_npx/xx/node_modules/create-typescript-app/lib/shared/cli/spinners.js:16:11)
    at async readOptions (file:///Users/john.reilly/.npm/_npx/xx/node_modules/create-typescript-app/lib/shared/options/readOptions.js:119:38)
    at async Object.create (file:///Users/john.reilly/.npm/_npx/xx/node_modules/create-typescript-app/lib/create/index.js:12:18)
    at async bin (file:///Users/john.reilly/.npm/_npx/xx/node_modules/create-typescript-app/lib/bin/index.js:67:36)
    at async file:///Users/john.reilly/.npm/_npx/xx/node_modules/create-typescript-app/bin/index.js:4:20 {
  [cause]: Error: Command failed: gh auth token
  /bin/sh: gh: command not found
  
      at genericNodeError (node:internal/errors:984:15)
      at wrappedFn (node:internal/errors:538:14)
      at ChildProcess.exithandler (node:child_process:422:12)
      at ChildProcess.emit (node:events:519:28)
      at maybeClose (node:internal/child_process:1105:16)
      at Socket.<anonymous> (node:internal/child_process:457:11)
      at Socket.emit (node:events:519:28)
      at Pipe.<anonymous> (node:net:338:12) {
    code: 127,
    killed: false,
    signal: null,
    cmd: 'gh auth token',
    stdout: '',
    stderr: '/bin/sh: gh: command not found\n'
  }
}

Additional Info

I tried first to create a repository for my organisation. That failed. I thought "ah, this is an organisation issue probably" so I retested creating under my username of johnnyreilly and that failed in the same way. So I think it's a general issue.

@johnnyreilly johnnyreilly added the type: bug Something isn't working :( label Aug 13, 2024
@johnnyreilly
Copy link
Collaborator Author

Dammit I should have read the docs.

First make sure you have the following installed:

GitHub CLI (you'll need to be logged in)
Node.js
pnpm

So this isn't actually an issue. That said, would be nice if an error in that section lead to a message like "Hey - do you have the GitHub CLI installed and are you logged in?"

@johnnyreilly
Copy link
Collaborator Author

Put together the above as an idea of what I meant - it's in no way ready to merge but I thought it would prompt thought at the very least. Feel free to close this as a non-issue if this is preferable.

@JoshuaKGoldberg
Copy link
Owner

Agreed, it would be very good to get better explained!

#1000 is my old WIP trying to get rid of gh altogether. It's not likely to land soon.

@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Please, send a pull request to resolve this! label Aug 13, 2024
@JoshuaKGoldberg
Copy link
Owner

Oh hey, #1000 landed. So we can close this out!

@aprilmintacpineda
Copy link

aprilmintacpineda commented Oct 20, 2024

I encountered this just now. Isn't the fix deployed yet? Why do I need to be logged in with Github CLI for this to work? I get it, it's initializing github repository. Would be good if there's an option NOT to do that and just keep everything locally.

@JoshuaKGoldberg
Copy link
Owner

See https://github.com/JoshuaKGoldberg/create-typescript-app/blob/eb80e733a765f00e0d0ff25b7d69af8d7c20face/docs/Options.md#skipping-api-calls and https://github.com/JoshuaKGoldberg/create-typescript-app/blob/eb80e733a765f00e0d0ff25b7d69af8d7c20face/docs/Options.md#offline-mode - you can disable GitHub APIs and/or have it run in an "offline" mode entirely.

#1193 tracks making a docs website that will make it easier to work with the docs.

@aprilmintacpineda
Copy link

Yeah, I figured the offline mode out after digging some more because I stuck on the "initializing github repository" part and it didn't progress even after waiting for more than 10 minutes -- though I was able to see the repository on my github account, the tool just didn't move to the next step somehow. Thanks for the kind response @JoshuaKGoldberg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants