由于错误而无法部署到具有特定项目的gh页:无法生成sh:没有此类文件或目录 [英] Cannot deploy to with gh-pages with specific project due to error: cannot spawn sh: No such file or directory

查看:95
本文介绍了由于错误而无法部署到具有特定项目的gh页:无法生成sh:没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继续获取错误:


错误:无法生成sh:无此类文件或目录

error: cannot spawn sh: No such file or directory

致命:无法分叉

该项目正确构建,但是在尝试部署我的网站时失败。
网站是使用 create-react-app创建的;在Windows 8 PC上,使用命令 gh-pages -d build

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"

此问题仅在我的PC上的该特定项目中发生,就像我使用 create创建新项目时一样-react-app在我的电脑上,它将很好地部署。该特定项目也可以使用 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.

在控制台上无法部署的错误

错误日志控制台引用

存储库

我必须沿着某个地方已经搞砸了。我查看了整个网络,尝试重新安装git,编辑器,依赖项,并且对造成这种情况的原因非常困惑。一定是操作系统的区别吗?谢谢!

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!

推荐答案

它试图生成 sh.exe ,但是可以找不到它。

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

您需要将包含sh.exe的git目录添加到系统变量中。

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

(开始并键入:'path'。这应该为您提供'系统环境变量'的快捷方式。如果没有,请查找如何在您的Windows版本上编辑环境变量。

(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.)

打开环境变量对话框后,看看在系统变量>路径列表中。那里可能有一个git目录,其中不包含 sh.exe 。您需要将其替换为一个(确保其中还包含 git.exe )。
在我的电脑上 sh.exe 在以下位置找到:

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

C:\Program Files\Git\bin

完成此操作后,请重新启动终端并尝试再次部署。

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

这篇关于由于错误而无法部署到具有特定项目的gh页:无法生成sh:没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆