1

So I'm trying to add the puppeteer and puppeteer-extra module to my GitHub repo. Unfortunately, the 'Chrome Framework' contained in one of these modules is over the 100Mb given by GitHub so it won't upload. Here is the error below:

image of error

I installed git large file storage with brew install git-lfs and then cd'd into my project directory and then ran git lfs install....not sure what to do to add the puppeteer files to the LFS though, but I THINK(?) that's what I have to do. I did some research into the docs but I don't really understand which extensions I am trying to put into the LFS. Any help on how to do this would be much appreciated.

stuartd
  • 62,136
  • 13
  • 120
  • 150
nickcoding2
  • 111
  • 1
  • 9
  • 2
    Are you sure you want to check `node_modules` into your version control? I would just push your source and package.json. – ggorlen May 06 '21 at 23:51
  • Well I'm deploying my project to Heroku, and this is just the way I've done it since the start of the project--is that not the ideal way? – nickcoding2 May 06 '21 at 23:54
  • 1
    Heroku will just install package.json when it recieves the push. – ggorlen May 06 '21 at 23:56
  • Does this answer your question? [Should I check in folder "node\_modules" to Git when creating a Node.js app on Heroku?](https://stackoverflow.com/questions/11459475/should-i-check-in-folder-node-modules-to-git-when-creating-a-node-js-app-on-he) – ggorlen May 06 '21 at 23:56
  • @ggorlen So how do I not commit ALL packages to a git repo? Usually, I just do git add ., but if I only want to commit specific files, how do I do that? – nickcoding2 May 07 '21 at 00:07
  • 3
    Use a `.gitignore` file that has `node_modules/` in it. – ggorlen May 07 '21 at 00:09
  • @ggorlen And should I just delete the current repo that has node_modules already committed? Or is there a way to remove node_modules from that? Also, what exactly is the command to add node_modules to an npm project? I tried messing around with it earlier but it wasn't working for me--also sorry that I'm such a noob haha – nickcoding2 May 07 '21 at 00:11
  • 1
    You could `git reset` or `git revert` to an earlier commit before you committed the whole `node_modules` directory, but that's up to you. I'm not sure what you mean by "npm project". No problem, everyone has had this question before at some point in developing node apps, hence the dupe suggestion. – ggorlen May 07 '21 at 00:13
  • @ggorlen So I did git reset --hard, then I ran touch .gitignore && echo "node_modules/" >> .gitignore && git rm -r --cached node_modules ; git status in the folder that I'm trying to commit to GitHub, and then I did git add ., git commit -m "newCommit", and then I did git push -u origin main.......the push didn't work again with the same error about the 100Mb limit. – nickcoding2 May 07 '21 at 00:20
  • All of that looks reasonable. You might need to `reset` to the exact commit hash though -- I'm not really sure what state your project is in so it's hard to advise. – ggorlen May 07 '21 at 00:34
  • @ggorlen Do I need to add package-lock.json as well as package.json? Or is it just package.json and then my app.js file that are needed in the GitHub repo? – nickcoding2 May 07 '21 at 00:39
  • [Do I commit the package-lock.json file created by npm 5?](https://stackoverflow.com/questions/44206782/do-i-commit-the-package-lock-json-file-created-by-npm-5) -- Yes – ggorlen May 07 '21 at 00:41
  • 1
    @ggorlen It worked! Thank you! – nickcoding2 May 07 '21 at 01:00
  • use forece push. ex-: `git push -f origin` – Kaumadie Kariyawasam May 07 '21 at 03:30

0 Answers0