2

I have an error when trying to push my React app onto Github. First I created the repository in Github. Then, I added the remote repository using git remote add origin <repo name>. Then I added and commit the files. Lastly I tried git push -u origin main. I got the following error:

remote: error: File node_modules/.cache/default-development/0.pack is 153.50 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/4.pack is 131.01 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/2.pack is 131.43 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-production/0.pack is 131.55 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/9.pack is 131.12 MB; this exceeds GitHub's file size limit of 100.00 MB

I do not understand how it would exceed the limit as I have created two other React apps with more code in the past and uploaded them the same way to Github. The only difference I can think of is that this project uses Tailwind Css and Firebase. How can I reduce the size of node_modules/.cache/default-development/9.pack or even find what the file is?

1

4 Answers 4

4

No need to push node_modules in git delete node_module then push it and then Just make a file .gitignore in the same directory where package.json and write

/node_modules

then try to push it and then you can run npm install

Sign up to request clarification or add additional context in comments.

7 Comments

node_modules has already been committed so .gitignore is not enough.
I know that he needs to delete node_module then push it and then he needs to add .gitignore
I edited the answer please remove your downvote and if you like it please upvote it means a lot
"…delete node_module…" Not enough just to delete and commit — node_module stays in previous commit(s). One needs to remove node_module from all previous commit(s) and that a bit harder then just "delete and push".
In that case large files are still in the previous commits and GitHub would not allow to push. "…better to not delete the last commits…" I never say anything about deleting commits, only about deleting large files from the previous commits.
|
2

In my experience, it is crucial to include this line in .gitignore

# eslint cache
.eslintcache

in addition to /node_modules (as mentioned by others). This prevents the *.pack cache files from being pushed which are very very large (at least in my case). This solved my problem. I hope it will be of help to others.

Comments

0

Nothing to worry , just go to your Project folder --> right click anywhere and check if show hidden files checked --> now you see a .git folder --> just delete that -> and thats it your problem is solved

create repo again with git init ........

1 Comment

This is not a good approach if you are working with a project in prodcution
0

For me, I just deleted .next from the GitHub repository. Add '/.next' in the git ignore file. Pull the repository again. install npm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.