零零乙 2012-10-25 10:23 采纳率: 33.3%
浏览 204
已采纳

如何在 node js 中卸载 npm 模块?

As commonly known, any npm module can be installed by running a simple command: npm install <module_name>.

I have installed a few modules that I do not use anymore and I just want to get them off. I have a few questions regarding this:

  • Do we have any command or process to uninstall a module from the root (something like npm uninstall <module_name>) or will simply removing the module files do?

  • How does it affect us if we keep the unused modules?

转载于:https://stackoverflow.com/questions/13066532/how-to-uninstall-npm-modules-in-node-js

  • 写回答

15条回答 默认 最新

  • bug^君 2012-10-25 10:33
    关注

    The command is simply npm uninstall <name>

    The nodejs documents https://npmjs.org/doc/ have all the commands that you need to know with npm.

    A local install will be in the node_modules/ directory of your application. This won't affect the application if a module remains there with no references to it.

    If you're removing a global package however, any applications referencing it will crash.

    Here are different options:

    npm uninstall <name> removes the module from node_modules, but not package.json

    npm uninstall <name> --save also removes it from dependencies in package.json

    npm uninstall <name> --save-dev also removes it from devDependencies in package.json

    npm -g uninstall <name> --save also removes it globally

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(14条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!