Didn"t forge 2012-10-25 10:23 采纳率: 25%
浏览 1266
已采纳

如何在 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条回答 默认 最新

  • 程序go 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条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器