[英]How to deploy MERN stack app to GitHub and Heroku?
I've been using ReactJS for front-end development for quite a while now a decided I want to upgrade my skill to full-stack with MERN (MongoDB - Express - React - Node).很长一段时间以来,我一直在使用 ReactJS 进行前端开发,我决定使用 MERN(MongoDB - Express - React - Node)将我的技能升级到全栈。 I've successfully developed my MERN app but failed the deployment process.
我已经成功开发了我的 MERN 应用程序,但部署过程失败了。
I was trying to use the "from GitHub to Heroku" method where you first upload everything to GitHub and from there use it on Heroku.我试图使用“从 GitHub 到 Heroku”方法,您首先将所有内容上传到 GitHub 并从那里在 Heroku 上使用它。 I wasn't even able to upload my file structure to GitHub so I'm looking for some help.
我什至无法将我的文件结构上传到 GitHub 所以我正在寻求帮助。
I was wondering maybe my file structure is wrong so here are some screenshots so you get the idea:我想知道也许我的文件结构是错误的,所以这里有一些屏幕截图,所以你明白了:
When I try to upload to GitHub I get this warning:当我尝试上传到 GitHub 时,我收到以下警告:
warning: adding embedded git repository: client
Followed up with bunch of hints... Why is this happening?跟着一堆提示......为什么会这样? I think both client and server have separate.gitignore files, might this be the issue?
我认为客户端和服务器都有单独的.gitignore 文件,这可能是问题吗?
cd (to the directory where client and server are)
git init
git add .
At this point I keep getting the warning:在这一点上,我不断收到警告:
warning: adding embedded git repository: client
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> client
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached client
hint:
hint: See "git help submodule" for more information.
Thanks for your help.谢谢你的帮助。
I think you used create-react-app.我认为您使用了 create-react-app。 create-react-app also initiates a git repository.
create-react-app 还启动了一个 git 存储库。
Just delete ./client/.git
and then do it.只需删除
./client/.git
然后执行此操作。 That should be fine.那应该没问题。
cd ./client
rm -rf .git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.