See Details
目录
如果你不再需要在代码中使用包,我们建议将其卸载并将其从项目的依赖中删除。
¥If you no longer need to use a package in your code, we recommend uninstalling it and removing it from your project's dependencies.
卸载本地包
¥Uninstalling local packages
从 node_modules 目录中删除本地包
¥Removing a local package from your node_modules directory
要从 node_modules 目录中删除包,请在命令行上使用 uninstall
命令。如果包是范围的,则包括范围。
¥To remove a package from your node_modules directory, on the command line, use the uninstall
command. Include the scope if the package is scoped.
这将卸载一个包,完全删除代表它安装的所有 npm。
¥This uninstalls a package, completely removing everything npm installed on its behalf.
它还会从 package.json 中的 dependencies、devDependencies、optionalDependencies 和 peerDependencies 对象中删除包。
¥It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json.
此外,如果你有 npm-shrinkwrap.json 或 package-lock.json,npm 也会更新这些文件。
¥Further, if you have an npm-shrinkwrap.json or package-lock.json, npm will update those files as well.
无范围的包
¥Unscoped package
npm uninstall <package_name>
范围包
¥Scoped package
npm uninstall <@scope/package_name>
示例
¥Example
npm uninstall lodash