gh-pages -d build gives Error “file” argument must be a non-empty string

会有一股神秘感。 提交于 2019-12-04 03:24:57

问题


I included all the steps for deploying my create react app on github. snippet of my package.json

"scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",`enter code here`
    "test": "node scripts/test.js",
    "homepage": "http://myName.github.io/create-react-wars",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
},

this is the error i am getting

gh-pages -d build
"file" argument must be a non-empty string
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-star-wars@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-star-wars@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\Jishu\AppData\Roaming\npm-cache\_logs\2019-08-02T17_13_43_435Z-debug.log

回答1:


Got the same issue; this answer solved my problem: https://stackoverflow.com/a/57315930/11879312

"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 gh-pages@2.0 --dev."




回答2:


I think the command is like this.

gatsby -d public -b master

Where public is the folder you want to push and master is the branch you want to push to. Please run your build before this



来源:https://stackoverflow.com/questions/57331878/gh-pages-d-build-gives-error-file-argument-must-be-a-non-empty-string

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