5

I'm deploy react app to git hub pages and receive error. File sizes after gzip:

68.67 KB  build\static\js\2.c2c334ae.chunk.js
 2.98 KB  build\static\js\main.8a72b1a2.chunk.js
  774 B   build\static\js\runtime~main.8f8a00a4.js

The project was built assuming it is hosted at /sort-customers-list/. 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://sejob.github.io/sort-customers-list, run: npm run deploy

Find out more about deployment here:

sort-customers-list@0.1.0 deploy 
C:\Users\SeJo\Documents\Code\DEV_HW\sort-customers-list
gh-pages -d build

The "file" argument must be of type string. Received type undefined

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sort-customers-list@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sort-customers-list@0.1.0 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\SeJo\AppData\Roaming\npm-cache\_logs\2019-08-01T12_09_52_445Z-debug.log
Community
  • 1
  • 1
Sergey Bekker
  • 53
  • 1
  • 3
  • First answer from here https://stackoverflow.com/questions/57314779/trying-to-deploy-my-react-app-with-gh-pages-but-got-this-error-message-the-fi really helped me. – Hennadii Shvedko Aug 02 '19 at 07:36

4 Answers4

5

The problem occurs in the new version of GitHub pages. Just use this command to install the previous version of GitHub pages:

npm install gh-pages@2.0.1

Hope it will help!

StardustGogeta
  • 3,331
  • 2
  • 18
  • 32
4

I also had this same problem on a fresh install of create-react-app. I have no idea what the problem was, but I did the following:

  1. Downgrade gh-pages from 2.1.0 to 2.0.1
  2. Instead of running npm run deploy, manually run npm run build then gh-pages -d build from the commandline.

At first, I'd get the same error in the commandline, even after checking that the version was downgraded to 2.0.1, but for some reason it worked after manually creating the gh-pages branch and pushing some files into it. As of now, npm run deploy throws the error but at least gh-pages -d build from the console works.

1

INSTALL/REINSTALL GIT Update NPM Reopen EDITOR

this solved my problem

SystemX
  • 481
  • 4
  • 10
0

use version 2.0.1

npm i gh-pages@2.0.1
Hein Soe
  • 43
  • 4