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

北战南征 提交于 2019-11-27 15:04:20
Rem Lampa

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!