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

北城以北 提交于 2019-12-10 18:25:43

问题


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!


回答1:


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 Files\Git\bin

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



来源:https://stackoverflow.com/questions/51464032/cannot-deploy-to-with-gh-pages-with-specific-project-due-to-error-cannot-spawn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!