npm-uninstall

本文详细介绍了如何使用npm命令卸载Node.js项目中的依赖包,包括全局和局部环境下的卸载方式,以及如何通过不同选项更新package.json文件。示例展示了如何移除不同类型的依赖,如普通依赖、开发依赖和可选依赖。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Remove a package

npm uninstall [<@scope>/][@]… [-S|–save|-D|–save-dev|-O|–save-optional|–no-save]

aliases: remove, rm, r, un, unlink

This uninstalls a package, completely removing everything npm installed on its behalf.

Example:

npm uninstall sax

In global mode (ie, with -g or --global appended to the command), it uninstalls the current package context as a global package.

npm uninstall takes 3 exclusive, optional flags which save or update the package version in your main package.json:

-S, --save: Package will be removed from your dependencies.

-D, --save-dev: Package will be removed from your devDependencies.

-O, --save-optional: Package will be removed from your optionalDependencies.

--no-save: Package will not be removed from your package.json file.

Further, if you have an npm-shrinkwrap.json then it will be updated as well.

Scope is optional and follows the usual rules for npm-scope.

Examples:

npm uninstall sax --save
npm uninstall @myorg/privatepackage --save
npm uninstall node-tap --save-dev
npm uninstall dtrace-provider --save-optional
npm uninstall lodash --no-save

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值