Getting error while removing node_modules
in git, vscode terminal
git rm -r --cached node_modules
Error:
fatal error: pathspec 'node_modules' did not match any files
Just Open your root folder with VSCode. Select node_modules folder and delete. Profit. (It will take few milliseconds to delete.)
Anybody can suggest if I delete node_modules folder and after re-creating it, will I get all the already installed packages back in the same way they were just before deleting? YES, you will get back all the packages listed in your package. json file.
Not committing node_modules implies you need to list all your modules in the package. json (and package-lock. json ) as a mandatory step. This is great because you might not have the diligence to do so, and some of the npm operations might break if you don't.
git rm -r --cached . git add . git commit -m "remove gitignore files" git push
I faced the same issue. Do the below steps -
Run below commands in your terminal
git rm -r --cached node_modules
git commit -am "node_modules be gone!"
git push origin master
That's all!
You are good to go!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With