Learn how to remove node_modules after they have been added to a remote repository.
How do you delete node_modules from your remote git repository if you added your .gitignore file after you already pushed your node_modules?
You might expect that your node_modules directory will automatically get deleted on your next push since you put it in your .gitignore file, right?
It doesn’t.
You have to remove the node_modules folder from the git repository first (right after creating your .gitignore file):
git rm -r --cached node_modulesNow you can commit your repository without node_modules:
git commit -m "Removed node_modules"And push your changes:
git push origin masterNow node_modules will get deleted from your remote repository.