for package in $(ls node_modules); do if [ "$package" != "npm" ]; then sudo npm uninstall $package; fi; done;
它删除了所有没有前缀 @的模块。所以我扩展了子目录的循环。
for package in $(ls node_modules); do if [ ${package:0:1} = \@ ]; then
for innerPackage in $(ls node_modules/${package}); do
sudo npm uninstall "$package/$innerPackage";
done;
fi; done;