0

Hey I have literally been trying this for days, I have went over documentation all over, I followed tutorials and I cannot get past npm run deploy when trying to deploy my react app to github pages. I call npm run build, I place the correct url to package.json as the 'homepage', i call it again and get the 'deploy' and 'predeploy', I definitely have gh-pages in node modules, I mean I got it all I have followed every step that every tutorial could have told me. I have ran into an issue that reads the following:

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.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Carlos\AppData\Roaming\npm-cache_logs\2018-10-04T19_57_57_731Z-debug.log

Here are the contents of the log:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'deploy' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ] 5 info lifecycle [email protected]~predeploy: [email protected] 6 verbose lifecycle [email protected]~predeploy: unsafe-perm in lifecycle true 7 verbose lifecycle [email protected]~predeploy: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Carlos\ReactJSProjects\carlos_valencia_portfolio\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\Carlos\AppData\Local\Microsoft\WindowsApps;C:\Users\Carlos\AppData\Roaming\npm;C:\Users\Carlos\AppData\Local\atom\bin;C:\Users\Carlos\AppData\Local\GitHubDesktop\bin 8 verbose lifecycle [email protected]~predeploy: CWD: C:\Users\Carlos\ReactJSProjects\carlos_valencia_portfolio 9 silly lifecycle [email protected]~predeploy: Args: [ '/d /s /c', 'npm run build' ] 10 silly lifecycle [email protected]~predeploy: Returned: code: 0 signal: null 11 info lifecycle [email protected]~deploy: [email protected] 12 verbose lifecycle [email protected]~deploy: unsafe-perm in lifecycle true 13 verbose lifecycle [email protected]~deploy: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Carlos\ReactJSProjects\carlos_valencia_portfolio\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\Carlos\AppData\Local\Microsoft\WindowsApps;C:\Users\Carlos\AppData\Roaming\npm;C:\Users\Carlos\AppData\Local\atom\bin;C:\Users\Carlos\AppData\Local\GitHubDesktop\bin 14 verbose lifecycle [email protected]~deploy: CWD: C:\Users\Carlos\ReactJSProjects\carlos_valencia_portfolio 15 silly lifecycle [email protected]~deploy: Args: [ '/d /s /c', 'gh-pages -d build' ] 16 silly lifecycle [email protected]~deploy: Returned: code: 1 signal: null 17 info lifecycle [email protected]~deploy: Failed to exec deploy script 18 verbose stack Error: [email protected] deploy: gh-pages -d build 18 verbose stack Exit status 1 18 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16) 18 verbose stack at EventEmitter.emit (events.js:182:13) 18 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 18 verbose stack at ChildProcess.emit (events.js:182:13) 18 verbose stack at maybeClose (internal/child_process.js:962:16) 18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5) 19 verbose pkgid [email protected] 20 verbose cwd C:\Users\Carlos\ReactJSProjects\carlos_valencia_portfolio 21 verbose Windows_NT 10.0.17134 22 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "deploy" 23 verbose node v10.8.0 24 verbose npm v6.2.0 25 error code ELIFECYCLE 26 error errno 1 27 error [email protected] deploy: gh-pages -d build 27 error Exit status 1 28 error Failed at the [email protected] deploy script. 28 error This is probably not a problem with npm. There is likely additional logging output above. 29 verbose exit [ 1, true ]

I have no idea what is going on, I read things online saying that I am not pointing at the folder that contains my sh.exe and that I have to specify it in my environment variables and whatnot. I literally tried everything I found in both google, bing and reddit. Im literally stumped and want to cry lol. Please help!

2 Answers 2

2

It would be helpful to see your package.json values for homepage, and in the scripts object, the predeploy and deploy values. That being said, here is how to deploy a React app to Github Pages:

  • After building your app and pushing to your github repo, install gh-pages by running the following in terminal:
    • npm install --save gh-pages
  • Update your package.json with the following:

    • "homepage": "https://[github-username].github.io/[repo-name]"
  • Inside your scripts object:
    • "predeploy": "npm run build",
    • "deploy": "gh-pages -d build"
  • Run
    • npm run deploy
Sign up to request clarification or add additional context in comments.

Comments

0

Would be helpful if you could add some code but might be worth checking out the bottom reply on this post:

https://github.community/t5/GitHub-Pages/My-react-project-doesn-t-work-on-github-pages/m-p/6806#M452

In particular, this section on client-side routing (if applicable to your application):

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#notes-on-client-side-routing

2 Comments

thanks for your reply, will def take a crack at this once again following this documentation...dumb question and i apologize for it but what code would you want to see??? maybe package.json?
yea those links really aren't addressing my problem at all, its just repeating the same steps that i have been trying for a while now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.