zoukankan      html  css  js  c++  java
  • 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,也就是不会跨大版本进行更新。

  • 相关阅读:
    Debian下通过SSHFS/SHFS挂载远程文件
    Linux下如何查看CPU信息, 包括位数和多核信息
    Nexus One USB in Ubuntu 9.10
    育儿书籍阅读顺序的建议
    Android 2.1 中 JNI 层 camera 的应用
    Android开发工具使用之adb
    改变父母的十本书
    在Ubuntu下使用adb
    改变父母的十本书之《童年的秘密》
    Ubuntu Lucid(10.04)上安装Google Android SDK环境
  • 原文地址:https://www.cnblogs.com/chucklu/p/15000737.html
Copyright © 2011-2022 走看看