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

后端 未结 3 864
终归单人心
终归单人心 2020-12-06 10:26

I was trying to deploy my React app with gh-pages but I\'m facing this error : The \"file\" argument must be of type string. Received type undefined.

At first, I th

相关标签:
3条回答
  • 2020-12-06 11:01

    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.

    0 讨论(0)
  • 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` // or
    
    npm install -D gh-pages@2.0
    
    0 讨论(0)
  • 2020-12-06 11:12

    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

    0 讨论(0)
提交回复
热议问题