P
P
Pavel2016-10-18 11:13:36
Windows
Pavel, 2016-10-18 11:13:36

What console command removes all NPM modules at once?

There was a need to delete the project folder on Windows. The folder also contains gulp modules. Simply deleting the folder in the explorer naturally does not help: everything is deleted except for the node_modules folder. This is understandable: node modules usually have huge nesting, and Windows does not like this. Unlocker does not help.
You can remove modules individually npm uninstall <module_name>. But it is very long, there are 20+ modules in the project.
Is there some command that can remove all modules at once? (Google didn't help me).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Damir Sayahov, 2016-10-18
@ncer

This can be easily done with the rimraf npm package.
Install rimraf globally in the system:
npm install rimraf -g
Then go to the node_modules folder and delete it with the following command:
rimraf node_modules

A
Alexander Taratin, 2016-10-18
@Taraflex

Универсальный способ удаления папок и файлов, вне зависимости от вложенности и длинны путей.
delete.bat

@del %1 /Q /F > nul
@set tempf=.temp%random%
@mkdir %tempf%
@attrib +H %tempf%
@robocopy %tempf% %1 /purge /NFL /NDL /NJH /NJS /nc /ns /np > nul
@rmdir %tempf%
@rmdir /S /Q %1

Использовать как
delete <путь к папке или файлу>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question