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.
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?