Ad

Cannot Deploy To With Gh-pages With Specific Project Due To Error: Cannot Spawn Sh: No Such File Or Directory

- 1 answer

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!

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad