My application is hosted in Alibaba Cloud ECS Instance and I am trying to uninstall the dependencies of the package.json. I understand the npm uninstall *
command will uninstall all the dependencies but the question is whether it will remove global installs too or not.
Asked
Active
Viewed 1,147 times
0

Ranjith Udayakumar
- 406
- 4
- 20
2 Answers
0
To uninstall a global package, type: npm uninstall -g <package>
.
It has the extra flag -g
for global.

Daniel Sixl
- 2,488
- 2
- 16
- 29
0
AFAIK there is no uninstalling with a wildcard like npm uninstall *
command in npm. The issue is still being opened here https://github.com/npm/npm/issues/19967.
Use this command to uninstall your global dependencies :
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
reference: Command to remove all npm modules globally?

hutabalian
- 3,254
- 2
- 16
- 13