Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploying create-react-app to gh-pages

This is well documented and I have followed the instructions very carefully several times over. HOWEVER, every time I run the 'npm run deploy' command on a completely vanilla create-react-app install, it fails on my system with this error:-

C:\React\weather-app>npm run deploy

[email protected] predeploy C:\React\weather-app npm run build

npm WARN invalid config loglevel="notice"

[email protected] build C:\React\weather-app react-scripts build

Creating an optimized production build... Compiled successfully.

File sizes after gzip:

37.45 KB build\static\js\main.9959b426.js 224 B build\static\css\main.e94ed898.css

The project was built assuming it is hosted at /weather-app/. You can control this with the homepage field in your package.json.

The build folder is ready to be deployed. To publish it at https://my-github-username.github.io/weather-app, run:

npm run deploy

Find out more about deployment here:

(https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment)

[email protected] deploy C:\React\weather-app gh-pages -d build

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\matt\AppData\Roaming\npm-cache_logs\2018-07-31T16_10_08_763Z-debug.log

This is driving me insane, PLEASE can anyone give me any pointers as to what's wrong with my local node, to prevent this script from running?

like image 917
Matt Avatar asked Apr 28 '26 12:04

Matt


1 Answers

I have the same problem! But I think I found a work around at least for the time being...

  1. Make a production build with either npm run build or a failed npm run deploy
  2. Then run gh-page's script that was supposed to run gh-pages -d build

Good luck!

like image 66
Greg McKelvey Avatar answered Apr 30 '26 03:04

Greg McKelvey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!