Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

reactjs - Cannot deploy to with gh-pages with specific project due to error: cannot spawn sh: No such file or directory

Keep getting the error:

error: cannot spawn sh: No such file or directory

fatal: unable to fork

The project builds correctly but when trying to deploy my website it fails. Website was created with "create-react-app" on my windows 8 pc with the command "gh-pages -d build"

This issue only occurs in this specific project on my pc as when I create a new project with "create-react-app" on my pc it'll deploy fine. This specific project can also be deployed fine with "gh-pages -d build" on my mac but not my pc.

Error of failing to deploy on console

Error log console references

Repository

Somewhere along the line I must've messed up something. I've looked over the web, tried reinstalling git, editor, dependencies and am super confused as to what's causing this. It must be an operating system difference? Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's trying to spawn sh.exe but can't find it.

You need to add the git directory that contains sh.exe to your system variables.

(go start and type: 'path'. This should provide you with a shortcut to 'system environment variables'. If not look up how to edit environment variables on your version of windows.)

Once you have the environment variables dialogue box open, have a look in the System variables > 'path' list. There may be a git directory there that doesn't contain sh.exe. You need to replace it with one that does (ensure this also contains git.exe). On my pc sh.exe was found in:

C:Program FilesGitin

Once this is done restart the terminal and attempt to deploy again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...