繁体   English   中英

当我尝试将 React 应用程序部署到 GitHub Pages 时,为什么会出现错误?

[英]Why I get an error when I try to deploy a react app to GitHub Pages?

我试图将反应应用程序部署到 GitHub 页面...

package.json 上的命令:

 "predeploy": "npm run build",
 "deploy": "gh-pages -d build",

并收到此错误:

The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

它应该部署。

我的已经解决了较新的 2.1 版有一些问题。 恢复到 2.0.1。

  • 重新安装特定版本的 Github 页面:
npm uninstall gh-pages

npm i gh-pages@2.0.1

npm run deploy // as usual

希望有所帮助。 :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM