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:\WINDOWS\system32>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,也就是不会跨大版本进行更新。

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(86)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2019-07-12 asp.net form submit 在Chrome里面看Form提交
2019-07-12 setTimeout
2019-07-12 .slideUp()
2019-07-12 jQuery .delay()
2019-07-12 JavaScript Thread.Sleep()
2019-07-12 HiddenField Class
2019-07-12 Uploading multiple files asynchronously by blueimp jquery-fileupload
点击右上角即可分享
微信分享提示