如何显示所有已安装的 npm 包并删除它们
How to display all installed npm packages and delete them
我想显示所有已安装的 npm 包(nodemailer、json 等)并删除它们。另外,我想清理 npm“历史记录”。
我读到我应该这样做:
npm list -g
显示所有包,但我不确定这是不是因为我最近下载了 nodemailer 但它不在这个列表中...
有什么帮助吗?谢谢!
试试这个:-
它删除所有全局 npm 模块。注意:这不适用于 Windows.
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
目录中的Windows
参考这个medim article to delete node modules in a folder
如果这对您不起作用,请参考此
.
我想显示所有已安装的 npm 包(nodemailer、json 等)并删除它们。另外,我想清理 npm“历史记录”。
我读到我应该这样做:
npm list -g
显示所有包,但我不确定这是不是因为我最近下载了 nodemailer 但它不在这个列表中...
有什么帮助吗?谢谢!
试试这个:- 它删除所有全局 npm 模块。注意:这不适用于 Windows.
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
目录中的Windows
参考这个medim article to delete node modules in a folder
如果这对您不起作用,请参考此 .