Error pushing ReactJS (CRA template) code to GitHub enterprise - reactjs

After cloning the empty repository I created in my Github Enterprise account, I created a CRA (create-react-app) ReactJS application. I created, committed & pushed a README.md file before generating the CRA scaffolding and it got pushed successfully. But, after CRA app got generated, I'm not able to push the code to the GitHub Enterprise server.
Git Bash throws the following error:
remote: fatal: early EOF
Whereas GitHub Desktop throws the following:
error: RPC failed; curl 56 Failure when receiving data from the peer
I have been using GitHub enterprise for NodeJS web app dev for years now and have never faced any issue of such sort but I have not been able to push the CRA based React app scaffolding code.
I have tried referring to the following StackOverflow posts:
Your configuration specifies to merge with the <branch name> from the remote, but no such ref was fetched.?
Git push error '[remote rejected] master -> master (branch is currently checked out)'
Cannot push to GitHub - keeps saying need merge
but those didn't work. Apparently, this use case is unique as the error only gets thrown (from all my experience working with this GitHub enterprise account) when I'm pushing CRA code and no other.
Attachments (Git Bash & GitHub Desktop errors):

This has been answered here: https://stackoverflow.com/a/36843260/1673761
Look here: https://flyingtomoon.com/2011/04/12/git-push-is-failed-due-to-rpc-failure-result56/
The problem is most likely because your git buffer is too low.
You will need to increase Git’s HTTP buffer by setting the git config var “http.postBuffer” to 524288000.
git config http.postBuffer 524288000

Related

Error while pushing a newly created react native app onto the Github or Gitlab

Background :
I have created a new react-native app using react-native init. Now I want to push this new repo to GitHub/GitLab with an initial commit message where I am facing the issue.
Issue:
While trying to push the project on the master branch of an empty repo I am getting a broken pipe error.
I am working on multiple projects and pushing the commits over ssh in different repositories on both Github and GitLab. There is no issue with old projects. Only when I create a new react-native app and try to push that in a new repo I am facing this issue. Can someone help me with this and tell me why this error is coming?
This issue was happened due to firewall software installed in the system. So if you are facing a similar kind of issue I am listing some of the things that might help:-
Check for any firewall software installed in the system.
Check for your internet connection.
Make sure your files don't exceed the git files limit if they do try to use git LFS.
If pushing via HTTP try increasing http.postbuffer size.

Why are terminal commands 'git add .', git commit...' and 'git push...' listed as optional when deploying React project?

Apologies, I am still a bit confused by git, although I am trying to teach myself more and improve.
I recently successfully deployed a React website to GitHub pages, following the often recommended steps of installing gh-pages to the project, adding a homepage property to the package.json file, adding scripts to the scripts properties on the package.json file, running 'npm run deploy' and so on. It worked fine, and now a build of the project has been added to my repository (here), and I can view the actual project online (here).
However, the issue I have is this: most guides on deploying a react app also mention the following steps:
in the terminal type:
git add .
git commit -m "commit"
git push origin master
These final steps are often listed as optional. Everything worked fine without me doing these steps: my code was added to the repository, and my website is deployed online, so what do these steps do exactly? Why are they considered optional? What is best practice?
These commands are not optional to me - when using only the command-line Git client, these commands accomplish the interaction of pushing the code (that, after you edit it, only exists locally on your own PC) to the Git repository server.
Everything worked fine without me doing these steps: my code was added to the repository, and my website is deployed online
I can see the following possibilities:
You are using another Git client and the push was done there;
You are using a Git tool (e.g. editing purely on the GitHub website), where the push happened without you being aware of it;
You did the terminal commands, without being aware of them;
A common resource to learn more about Git would be the Git book on the official Git SCM website: https://git-scm.com/book/en/v2

deploying MERN stack, using github pages and heroku

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 both frontend and backend.
A2. I still see this in terminal, but it does resolve.
Resolving node version 12.x...

"Cannot use import statement outside a module" error when deploying to Heroku

I'm fairly new to both development and Heroku but I am working through trying to deploy a react app. I can run the app perfectly fine when I run it locally, however I keep running into issues when I try to deploy to Heroku. It appears to build successfully, however I keep ending up with an application error and when I check the heroku logs I get the following:
heroku logs
When I searched for this syntax error it seems to be pretty popular and it looks like it might have something to do with my index.js file being buried in client -> src -> index.js (I specify this location in my Procfile). What I don't understand though is why this import error doesn't give me any trouble locally, only when I try to push to Heroku.
Edit:
Additional error is logged here. No Demon Errors
I had a similar issue when trying to deploy my first react app to heroku
I found a super simple solution that makes deploying to heroku painless.
Here are the steps I followed to do this:
create-react-app $APP_NAME
cd $APP_NAME
git init
heroku create $APP_NAME --buildpack https://github.com/mars/create-react-app-buildkit.git
git add .
git commit -m "initial commit"
git push heroku master
[https://www.youtube.com/watch?v=zDiQrgeGTuU&t=135s][1] Here is a link to the youtube video I followed.
As far as I can tell the buildpack was the major key here as it did most of the heavy lifting in terms of preparing the app for launch.
I tried this, but got the following error
-----> Building on the Heroku-20 stack
-----> Using buildpack: https://github.com/mars/create-react-app-buildkit.git
! error fetching custom buildpack https://github.com/mars/create-react-app-buildkit.git
! Push failed

Error initializing environment after running "amplify init."

Working on a web app using react.js that I picked up from another developer. Currently, trying to use AWS Amplify and I will eventually use AWS Cognito for authentication purposes.
I am using the following tutorial: https://hackernoon.com/react-authentication-in-depth-4deebda9aa45
I've already executed the following commands:
$ npm i -g #aws-amplify/cli
$ amplify configure
I've set up my CLI with the amplify config command, to include setting up the environment, access key ID and Secret Access key.
Error comes after running
$ amplify init
I've already seen a stack overflow post that states that this is a known error for the CLI, and that a fix has been implemented in the latest version of the CLI. I've tried updating amplify and re-installing. This is my second attempt to reinstall.
Here is a copy of the error in terminal.
MacBook-Air% amplify init
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? Yes
? Choose the environment you would like to use: discrete
Using default provider awscloudformation
✖ There was an error initializing your environment.
init failed
{ AccessDenied: Access Denied
at Request.extractError (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/services/s3.js:585:35)
at Request.callListeners (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
message: 'Access Denied',
code: 'AccessDenied',
region: null,
time: 2019-05-01T18:09:17.901Z,
requestId: '7814262360A7DF07',
extendedRequestId:
'Y1woT4qs3VOtSCQG7sWNu7zexB2O+ZNP3oiBugTdfkHbK4Um5vzOS05P5qsZRcRFUPVTAbey8Q0=',
cfId: undefined,
statusCode: 403,
retryable: false,
retryDelay: 155.200421877319 }
Expect environment to properly initialize and amplify to be properly configured.
In my case, I cloned a repo from codecommit and doing amplify init and facing the same problem. To solve this, I rename aws-export.js to aws-export.mjs and again run amplify init and it initialize the project without any error.
You can check those issues reported at github project.
We had a similar issue using '#aws-amplify/cli' is version: '2.0.0', at aws Amplify Console.
Our envs develop, PR, etc. were building fine but master did not.
So, we change the version from 2.0.0 to 4.0.0 and build start working again.
Check
Console broken again (probably related to aws-amplify/cli 2.0.0)
AccessDenied error when deploying backend
It looks like the git repo has already teamproviderinfo.json present or some environment setting checking conflicting with your current setting. So when you try to init the project with environment name 'dev' or the one with the copied repo from git, it is trying to reuse the existing resources.
Solution: Try using a different name for the environment instead of dev and see if that works.
In my case it solved such issue.

Resources