kentcdodds / react-fundamentals

Material for my React Fundamentals Workshop

Home Page:https://epicreact.dev/fundamentals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows: git-sh-setup: file not found

jsehull opened this issue · comments

git 2.28.0.windows.1
node 12.16.3
npm 6.14.5

$ npm run setup --silent
▶️  Starting workshop setup...
      Running the following command: npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q
npm ERR! code 1
npm ERR! Command failed: git submodule update -q --init --recursive
npm ERR! C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jesse\AppData\Roaming\npm-cache\_logs\2020-09-29T18_27_51_194Z-debug.log
Install for [ 'git+https://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git' ] failed with code 1

I have attempted to add to my PATH as shown here: https://stackoverflow.com/questions/49256190/how-to-fix-git-sh-setup-file-not-found-in-windows

https://cdn.discordapp.com/attachments/759594468197924880/760569985768357888/unknown.png
https://cdn.discordapp.com/attachments/759594468197924880/760570170523254792/unknown.png

Backslash related? Thoughts anyone?

Same thing happening on my end as well.
I've also tried to

set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"

directly in the terminal.
It is still not working.

I had a similar error saying that is could not access the URL for the command. Turns out I had my VPN on. I turned that off and it worked fine. Maybe that will help.

I had a similar error saying that is could not access the URL for the command. Turns out I had my VPN on. I turned that off and it worked fine. Maybe that will help.
If this solution doesn't work for @cbtsao47 or @jsehull, please notify on here again 😄

No VPN for me 🤔

@jsehull Are you using any kind of proxy on your network setup? That was one of the other things I came across when I was trying to fix it. Hope that helps.

Not right now, just some traditional, local development. npm and yarn commands have been working for years on this machine. Really unsure how to address it. I am special if I'm the only one though, right???

Have you checked with people in the Discord Epic React #General channel? @jsehull

Edit: I brought it up and hopefully someone can find a fix for you

Yeah I was speaking with some previously and had linked this in the #react-fundamentals channel. Unsure what the proper Tech channel is, ty.

Yeah I was speaking with some previously and had linked this in the #react-fundamentals channel. Unsure what the proper Tech channel is, ty.

Gotcha, yes that is a good channel for it as well, I brought it up again for you.

@JacobMGEvans No VPN for me either 😂

You need to add them to the PATH not as their own env variables
From env variables click on Path > edit > new > and enter the values in the stack overflow answer one at a time

You need to add them to the PATH not as their own env variables
From env variables click on Path > edit > new > and enter the values in the stack overflow answer one at a time

I believe that's exactly what we tried. 😂

@merodiro (thanks for the discord shoutout fella), I think you're right, I added it to the USER section at the top thinking I was copying the solution steps

@cbtsao47 I deleted the variable paths in the top area

This may be solved for me (but I also wiped WSL and installed WSL2 and got it working there first ha 😬, so I can't say for certain that this solves it, but I believe it does

image
image

Thanks for the conversation here folks (sorry I haven't been able to reply yet... been a little... busy 😅). If @jsehull's solution works for others, then we may want to include a reference to this issue in the README.

I just ran npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git instead of npx https://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git and that fixed it

@kterry1,

Oh, now that is interesting... I'll have to test it out and see whether that works better for everyone. Thanks!

Ah, bummer, when I try that I get:

The authenticity of host 'gist.github.com (140.82.114.4)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

@kterry1, did you get that when you changed it?

It's possible I could use this mechanism as a fallback. Not as nice an experience, but better than having to figure out the workarounds we've explored here. Thoughts?

Yeah @kterry1 npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git resolved it for my as well, thank you.

I tried to run npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git from cmd and WSL and I didn't get that warning
I deleted github.com from known hosts to be sure but still don't get this message
I only get it when I run npx ssh://git@gist.github.com:bb452ffe53a5caa3600197e1d8005733.git

I just ran npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git instead of npx https://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git and that fixed it

This also worked for me @kentcdodds 👏 . @kterry1 Thanks 🙏. PS. I am on windows too. @kterry1 do I need to run this every time for the next sections? 🤔

I just ran npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git instead of npx https://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git and that fixed it

Worked for me too. Thanks @kterry1 !!

This also worked for me @kentcdodds 👏 . @kterry1 Thanks 🙏. PS. I am on windows too. @kterry1 do I need to run this every time for the next sections? 🤔

You can do the StackOverflow solution and add it to Path one time only

@kentcdodds I tried to investigate what is causing the issue, it's seems something related to spawnSync, not the gist's URL

I removed C:\Program Files\Git\mingw64\libexec\git-core from the path so I reproduce it again
running npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q directly works for me but running it from npm run setup doesn't work, and I also tried updating scripts/setup.js to use git:// but that didn't do any difference

Ah! Interesting. Thanks for that investigation @merodiro. Maybe we need to use execSync instead? Or would the async version work?

I tried both of them but they didn't work and I got the same error

I had the same problem as everyone else. I tried using powershell (in administration mode) and did the same command as before, and it worked.

I'm sorry this has been so much trouble for a handful of people. For most people things seem to be working smoothly, for the rest of you folks I'm considering different options to improve things.

In the mean time, if you're just totally stuck, you can try this... I don't like it, but it's better than being stuck.

Copy/paste the exercise code into a Codesandbox and most of the exercises should work fine. For example: https://codesandbox.io/s/stupefied-austin-zmeqj?file=/src/exercise/index.js

For the HTML exercises, you could copy/paste those into a jsbin: https://jsbin.com/hubaqekehu/edit?html,output

This should be enough to get you going until you can figure out why things aren't installing properly.

I've also reached out to the codesandbox team to see whether they can fix the problems with the workshop working as it is directly in codesandbox (so you don't have to copy/paste things). Because this should work, but it's not: https://codesandbox.io/s/github/kentcdodds/react-fundamentals

You'll hear from me if they get that fixed. Thank you again for your persistence and patience!

Same thing happening on my end as well.
I've also tried to

set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"

directly in the terminal.
It is still not working.

I may be wrong, but I'm pretty sure you need to escape the backslashes. Have you tried set "PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\libexec\\git-core"?

I have the same problem, tried solutions above but did not worked for me

I just ran npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git instead of npx https://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git and that fixed it

This solution works for me too. Thanks man!

BTW: I'm working on windows SO too.

Probably too late into this issue. But for me setting PATH and restarting the terminal worked like a charm !

I've had the same problem and I tried this solution npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git. Now everything is great but I've got another problem. Now I have my email in the feedback form two times:

name@gmail.comname@gmail.com

Please can you recommend me how I can change it and do not edit it every time by myself?

Hi @dandelionadia, you could do a find/replace with your editor. That's probably the easiest.

Also, I just updated the autofill script so getting a double-email like that shouldn't happen again.

Ok, I just updated to use the npx git:// URL. Hopefully that fixes issues for everyone and we don't have problems like this for folks: #27 (comment)

If we do, then I could add an isWindows condition. I want to make sure that this works flawlessly for everyone. Thanks everyone for your patience!

@kentcdodds I just tested it and it still doesn't work, running npx "git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git" -q in the terminal works fine, and running node script/setup.js directly works fine but the problem still happens when I run npm run setup
it seems to be a bug in npm itself, I got the same problem when I replaced the setup script with "setup": "npx git://gist.github.com/bb452ffe53a5caa3600197e1d8005733.git -q" so it's not related to spawnSync as I assumed before

Oh, interesting! I wonder what's causing this 🤔 What exactly happens for you when you run it using npm run setup @merodiro?

@kentcdodds I get the same error they get that git-sh-setup: file not found
the problem happens when you run npx <gist> inside npm scripts, it's not a problem with something in your gist, I tried another gist and got the same error
Currently the working solutions are:

  • the StackOverflow's answer about adding it to the path and restart the terminal
  • running the npx command directly
  • running the setup script directly node script/setup.js

Ah! So it works ok if you run it with node directly? In that case, maybe we should switch it to running the setup script. I think that's simple enough.

I'll update all the repos to suggest that instead 👍

Quick question, if you use node script/setup.js does it work even with the npx https://... URL, or do we still have to use the git:// URL? Reason I ask is because I think it may concern people to see just some random gist, where it may make people feel better to see my username in there.

Yes, as far as I can see with the errors npx https://... and npx git://... work or break in the same way, and the only reason it worked for who tried it is because they tried running it directly

I created a repo to reproduce the issue https://github.com/merodiro/npx-problem to make sure it's not related to anything in this repo

That's brilliant. I'm guessing you could use that to report an issue to the npm client: https://github.com/npm/cli

For now, I'll update everything to show node scripts/setup.js instead of npm run setup. In fact, maybe I'll just make it node setup. That'll match the node go in the bookshelf app. And I'll switch it back to the https:// version.

Thanks so much for your investigation here @merodiro!

@all-contributors please add @merodiro for ideas

No problem, happy to help
I will try to write a better description and report the issue to npm team this weekend
I tried adding CI to the repo to display the errors better, it works on appveyor butbreaks as expected on CircleCI

I've got all the repos updated to solve this problem. Thanks everyone!

@kentcdodds I had the same issue last night and checked again and it seems not fixed I cloned the react-hooks just few minutes ago and the script failed with same error. If I add the ...\Git\mingw64\libexec\git-core to SYSTEM ENV variables it will work again.

Can someone else confirm if this still stands or is it fixed and my system is buggy. PS. you must close the terminal and start it again for Env Vars to be "updated" for the console, I had to keep it closed for a few minutes so that was a bit unexpected.

I just had this same problem. The instructions on https://epicreact.dev/modules/react-fundamentals/react-fundamentals-welcome instructed to use npm run setup --silent, which failed for me. I used node setup instead and it worked.

If anyone can figure out a good way to detect this issue, then we could provide a much better warning and fix message in the setup script (similar to what we do for detecting the presence of npx).

Help and contributions is appreciated :)

FYI: this error happened to me on Sunday - but only in git bash, npm run setup worked fine for me in Cmd..

I had the same problem as everyone else. I tried using powershell (in administration mode) and did the same command as before, and it worked.

This worked perfectly for me.

If anyone else has this issue, try running the script in cmd / powershell, possibly with admin rights.