【问题标题】:whether the npm uninstall * command will remove the global installs too while uninstalling the dependencies of package.json or not?npm uninstall * 命令是否会在卸载 package.json 的依赖项时也删除全局安装?
【发布时间】:2019-03-18 23:38:43
【问题描述】:

我的应用程序托管在阿里云 ECS 实例中,我正在尝试卸载 package.json 的依赖项。我知道npm uninstall * 命令将卸载所有依赖项,但问题是它是否也会删除全局安装。

【问题讨论】:

    标签: node.js npm alibaba-cloud alibaba-cloud-ecs


    【解决方案1】:

    AFAIK 没有在 npm 中使用像 npm uninstall * 命令这样的通配符进行卸载。问题仍在此处https://github.com/npm/npm/issues/19967

    使用这个命令卸载你的全局依赖:

    npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm

    参考:Command to remove all npm modules globally?

    【讨论】:

      【解决方案2】:

      要卸载全局包,请键入:npm uninstall -g <package>。 它具有用于全局的额外标志 -g

      【讨论】:

        猜你喜欢
        • 2013-10-25
        • 2013-01-17
        • 2015-07-24
        • 2016-08-02
        • 1970-01-01
        • 2020-10-01
        • 2011-12-16
        • 1970-01-01
        • 2011-08-24
        相关资源
        最近更新 更多