5

我正在将反应应用程序部署到 git 中心页面并收到错误。gzip 后的文件大小:

68.67 KB  build\static\js\2.c2c334ae.chunk.js
 2.98 KB  build\static\js\main.8a72b1a2.chunk.js
  774 B   build\static\js\runtime~main.8f8a00a4.js

该项目是在假设它托管在/sort-customers-list/. 您可以使用package.json.

构建文件夹已准备好部署。要在https://sejob.github.io/sort-customers-list上发布它,运行: npm run deploy

在此处了解有关部署的更多信息:

sort-customers-list@0.1.0 deploy 
C:\Users\SeJo\Documents\Code\DEV_HW\sort-customers-list
gh-pages -d build

“文件”参数必须是字符串类型。接收类型未定义

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sort-customers-list@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sort-customers-list@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\SeJo\AppData\Roaming\npm-cache\_logs\2019-08-01T12_09_52_445Z-debug.log
4

4 回答 4

5

该问题出现在新版本的 GitHub 页面中。只需使用此命令安装以前版本的 GitHub 页面:

npm install gh-pages@2.0.1

希望它会有所帮助!

于 2019-08-01T17:13:54.873 回答
4

我在全新安装的create-react-app. 我不知道问题是什么,但我做了以下事情:

  1. gh-pages从降级2.1.02.0.1
  2. 然后npm run deploy从命令行手动运行,而不是运行。npm run buildgh-pages -d build

起初,我会在命令行中遇到同样的错误,即使在检查版本已降级为2.0.1之后,但由于某种原因,它在手动创建gh-pages分支并将一些文件推入其中后仍然有效。截至目前,npm run deploy抛出错误,但至少gh-pages -d build从控制台工作。

于 2019-08-01T13:46:39.933 回答
1

安装/重新安装 GIT 更新 NPM 重新打开编辑器

这解决了我的问题

于 2020-09-05T04:30:04.040 回答
0

使用版本 2.0.1

npm i gh-pages@2.0.1
于 2020-09-20T20:12:05.880 回答