-1

I have an existing project built using angular that I am trying to push into githubs remote server. I am able to push all the folders besides the node_modules folder which is quite big and contains hundreds of files. I read that it is bad practice to include this in the repo and it is also ignored by github, as specified in the .gitignore file.

I need the node_modules folder else the project wont run. getting an error that it is missing modules. What is the solution for this?

I need to share the project with someone and without this folder, it simply wont work.

Thank you in advance

Shaakira
  • 21
  • 4
  • You don't need to push the node_modules folder. The package.json file will contain all you dependencies and will only require an npm install to get your node_modules. If you really insist on pushing your node_modules folder edit your .gitignore and remove the line that references node_modules/ – Jason White Jul 30 '21 at 00:08

1 Answers1

0

You're right that you shouldn't commit the node_modules folder. Instead, the person you are sharing the project with should run "npm install" in order to install all your project's dependencies into his own "node_modules"

To answer the question, you may commit a file that is ignored using:

git add -f node_modules

Force add despite the .gitignore file

Simon Tran
  • 1,461
  • 1
  • 11
  • 28