Trying to deploy my React app with gh-pages but got this error message : The "file" argument must be of type string. Received type undefined Trying to deploy my React app with gh-pages but got this error message : The "file" argument must be of type string. Received type undefined reactjs reactjs

Trying to deploy my React app with gh-pages but got this error message : The "file" argument must be of type string. Received type undefined


Seems like a bug in gh-pages 2.1.

I solved mine by downgrading gh-pages to version 2.0:

yarn add gh-pages@2.0 -D` // ornpm install -D gh-pages@2.0


Update: Fixed in gh-pages@2.1.1. You can now update your gh-pages package to latest version to fix this.

npm i gh-pages@latest

If you don't wish to downgrade to version 2.0.1, the workaround is to instead of using "deploy": "gh-pages -d build" as your deploy script, use:

"deploy": "gh-pages -d build --git git"

This somehow fixes the problem.

You can find the GitHub issue about this bug here: tschaub/gh-pages#308


Whenever you start your program, you use npm start. This can be used for Deploy too. Instead of doing npm run deploy, the command should be npm deploy.