I am following this guide to deploy MERN stack app, using heroku and github pages -https://github.com/juliojgarciaperez/deploy-mern
Q1. Do I need to create 2 different repositories, 1 for backend and 1 for frontend to connect to heroku? (t.ex backend repository to the heroku pipeline) I originally developed both backend and frontend under same repository.
Q2. I managed to get the step:3 in guide, and created the new base set up for react app, following the guide mentioned - https://elements.heroku.com/buildpacks/mars/create-react-app-buildpack
after generating the react app using this buildpack
command, I replace the src
and public
with what I have written before, also install the dependencies.
but when I run the git push heroku master
command in terminal,
I get errors saying
error: failed to push some refs to 'https://git.heroku.com/apprepositorynamehere.git'
And when I read the process, it says
engines.node (package.json): unspecified
Cannot find module: 'react-router-dom'. Make sure this package is installed.
You can install this package by running: yarn add react-router-dom.
error Command failed with exit code 1.
To solve each problem, I add the node
with specified version in package.json
"engines": {
"node": "13.7.0"
},
and also ran the yarn add
command to install the react-router-dom
But none of the issues goes away when i re-run the git push heroku master
.
I originally create the react app and developed in npm
setting not yarn
.
I wonder if this is causing the issue where copy pasting my previous src
?
I wanted to use the github pages bcs it is easy to deal with but If anyone has any other suggestion, to deploy MERN stack app, I am opened to it!
To anybody who is looking for an answer to my previous question.
I did not use the
github page
to deploy my MERN stack app, but used this tutorial 'https://www.youtube.com/watch?v=qdoiwouykAg'A1. You do not need 2 different repository, but need to configure your
package.json
in bothfrontend
andbackend
.A2. I still see this in terminal, but it does resolve.