'How to delete Node_modules folder in command line on Windows?
So, I should delete all node_modules in my project(I want that the node_modules folder become completely empty). Just removing folder manually does not suit me.
I read that I can delete it with rm -rf node_modules/
BUT it does not work on WINDOWS.
How to delete it?
Solution 1:[1]
Deleting node_modules is as simple as writing the node_modules without a slash:
rm -rf node_modules
rm -rf node_modules
shouldn't have a slash at the end /
, and this worked for me even on Widows.
Solution 2:[2]
Installing globally rimraf will do the job.
npm install -g rimraf
From the docs:
If installed with
npm install rimraf -g
it can be used as a global command rimraf [ ...] which is useful for cross platform support.
So with installing this package, you can remove directories on all platforms(windows, linux).
All left to do is rimraf node_modules
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | SherylHohman |
Solution 2 | Naor Levi |