deploy with gh-pages error cannot spawn sh: No such file or directory
when deploying to github pages using gh-pages i get this error:
error: cannot spawn sh: No such file or directory
fatal: unable to fork
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
there is a homepage property in my package.json file and i have the scripts:
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
npm version - 6.1.0 create-react-app version - 1.5.2 node version - 8.11.3 react-scripts version - 1.1.4
prehistory had same problem on Visual Studio Code: Version: 1.25.1 Commit: 1dfc5e557209371715f655691b1235b6b26a06be Date: 2018-07-11T15:43:53.668Z Electron: 1.7.12 Chrome: 58.0.3029.110 Node.js: 7.9.0 V8: 5.8.283.38 Architecture: x64
somehow it happend few days ago after i updated my npm(something like that): npm install npm@latest -g
after that when i try to deploy my react build to gh-pages: npm run deploy
i got an error: gh-pages -d build
error: cannot spawn sh: No such file or directory fatal: unable to fork ...
my solution:
open VSCode settings and add this: { "git.path": "C:\Program Files\Git\bin\git.exe", "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\sh.exe" }
by default git.path was set to null. about sh path i read some ideas here: https://emacs.stackexchange.com/questions/32526/magit-commit-error-cannot-spawn-sh-cannot-start-editor
the result is: https://imgur.com/a/RxfGMJp
Closing as stale. Please open a new issue if there's still a problem.
when i write { "git.path": "C:\Program Files\Git\bin\git.exe", "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\sh.exe" } in vscode settings it gives error saying Invalid escape character in string. pls any help.
@MRGHOSJ Use escape character E.g. - C:\\Program Files\\Git\\bin\\git.exe