簡體   English   中英

如何將 MERN 堆棧應用程序部署到 GitHub 和 Heroku?

[英]How to deploy MERN stack app to GitHub and Heroku?

很長一段時間以來,我一直在使用 ReactJS 進行前端開發,我決定使用 MERN(MongoDB - Express - React - Node)將我的技能升級到全棧。 我已經成功開發了我的 MERN 應用程序,但部署過程失敗了。

我試圖使用“從 GitHub 到 Heroku”方法,您首先將所有內容上傳到 GitHub 並從那里在 Heroku 上使用它。 我什至無法將我的文件結構上傳到 GitHub 所以我正在尋求幫助。

我想知道也許我的文件結構是錯誤的,所以這里有一些屏幕截圖,所以你明白了:

在此處輸入圖像描述

在此處輸入圖像描述

在此處輸入圖像描述

當我嘗試上傳到 GitHub 時,我收到以下警告:

warning: adding embedded git repository: client

跟着一堆提示......為什么會這樣? 我認為客戶端和服務器都有單獨的.gitignore 文件,這可能是問題嗎?

cd (to the directory where client and server are)
git init
git add .

在這一點上,我不斷收到警告:

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.

謝謝你的幫助。

我認為您使用了 create-react-app。 create-react-app 還啟動了一個 git 存儲庫。

只需刪除./client/.git然后執行此操作。 那應該沒問題。

cd ./client
rm -rf .git

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM