How to remove node_modules
Create a .gitignore file

    Check for an existing .gitignore file in the project directory

ls -a

    If your project directory has a .gitingore file - skip to step 3. Otherwise, continue with:

Create a .gitignore file in the git repository

touch .gitignore

Remove the node_modules directory

    Open up the .gitignore and add the following line to the file

**/node_modules

    Remove the node_modules folder from the git repository

git rm -r --cached node_modules

Commit All Changes

    Commit the git repository without the node_modules folder

git commit -m "Removed node_modules folder"

    Push the change to the remote repo

git push origin main

    Commit the .gitignore file

git add .gitignore
git commit -m "Updated the .gitignore file"
git push origin main

By admin

Leave a Reply

Your email address will not be published.