问题
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