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 741 times
0
Ranjith Udayakumar
- 386
- 2
- 19
2 Answers
0
To uninstall a global package, type: npm uninstall -g <package>.
It has the extra flag -g for global.
Daniel Sixl
- 2,364
- 2
- 15
- 28
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
- 2,758
- 1
- 15
- 13