• npm outdated -g --depth=0


    list all globally installed modules with one command in ubuntu

    The below command will list all your globally installed modules on Linux, Mac, and Windows.

    npm ls -g --depth 0
    

    How do I install a module globally using npm?

    If you want to install a npm module globally, make sure to use the new -g flag, for example:

    npm install forever -g

    The general recommendations concerning npm module installation since 1.0rc (taken from blog.nodejs.org):

    • If you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your project.
    • If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

    I just recently used this recommendations and it went down pretty smoothly. I installed forever globally (since it is a command line tool) and all my application modules locally.

    However, if you want to use some modules globally (i.e. express or mongodb), take this advice (also taken from blog.nodejs.org):

    Of course, there are some cases where you want to do both. Coffee-script and Express both are good examples of apps that have a command line interface, as well as a library. In those cases, you can do one of the following:

    • Install it in both places. Seriously, are you that short on disk space? It’s fine, really. They’re tiny JavaScript programs.
    • Install it globally, and then npm link coffee-script or npm link express (if you’re on a platform that supports symbolic links.) Then you only need to update the global copy to update all the symlinks as well.

    The first option is the best in my opinion. Simple, clear, explicit. The second is really handy if you are going to re-use the same library in a bunch of different projects. (More on npm link in a future installment.)

    I did not test one of those variations, but they seem to be pretty straightforward.

    npm outdated -g --depth=0

    C:WINDOWSsystem32>npm outdated -g --depth=0
    Package Current Wanted Latest Location
    @vue/cli 4.5.9 4.5.13 4.5.13 global
    @vue/cli-init 4.5.9 4.5.13 4.5.13 global
    cnpm 6.1.1 6.2.0 7.0.0 global
    date-time 3.1.0 3.1.0 4.0.0 global
    sass 1.30.0 1.35.2 1.35.2 global
    vue 2.6.12 2.6.14 2.6.14 global

    npm update -g 只会更新红色的package,也就是不会跨大版本进行更新。

  • 相关阅读:
    栈的使用
    学习
    JS中常用的工具类
    AOP的相关概念
    Git-用git同步代码
    权限管理3-整合Spring Security
    权限管理2-开发权限管理接口
    权限管理1-需求描述
    使用Canal作为mysql的数据同步工具
    使用存储过程在mysql中批量插入数据
  • 原文地址:https://www.cnblogs.com/chucklu/p/15000737.html
Copyright © 2020-2023  润新知