我包括了在github上部署我的create react应用程序的所有步骤。
我的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"
},
这是我得到的错误
gh-pages -d build
"file" argument must be a non-empty string
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
最佳答案
遇到了同样的问题;这个答案解决了我的问题:https://stackoverflow.com/a/57315930/11879312
“似乎是gh-pages 2.1中的错误。我通过将gh-pages降级到2.0版来解决了我的问题: yarn 添加[email protected] -D或npm install [email protected] --dev。”
关于reactjs - gh-pages -d生成给出错误 "file"参数必须是非空字符串,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57331878/