本文翻译自:How to list npm user-installed packages?

How do I list the user-installed package ONLY in npm ? 如何仅在npm列出用户安装的软件包? When I do npm -g list it outputs every package and their dependencies, which is not what I want. 当我执行npm -g list它会输出每个包及其依赖项,这不是我想要的。


#1楼

参考:https://stackoom.com/question/1DGTw/如何列出npm用户安装的软件包


#2楼

One way might be to find the root directory of modules using: 一种方法可能是使用以下方法查找模块的根目录:

npm root
/Users/me/repos/my_project/node_modules

And then list that directory... 然后列出该目录......

ls /Users/me/repos/my_project/node_modules
grunt                   grunt-contrib-jshint

The user-installed packages in this case are grunt and grunt-contrib-jshint 在这种情况下,用户安装的包是grunt和grunt-contrib-jshint


#3楼

Node_modules contains user-installed packages so change the directory to node_modules and list the items. Node_modules包含用户安装的软件包,因此将目录更改为node_modules并列出项目。 Core Modules are defined in node's source in the lib/ folder. 核心模块在lib/文件夹的节点源中定义。

Example:

     example@example:~/:~/node_modules$ lsexpress  maxmind-native  node-whois  socket.io  ua-parser-jsgeoip    mongoskin       pdfkit      tail       zeromqmaxmind  nodemailer      request     ua-parser  zmq

#4楼

您可以使用以下命令获取所有全局安装模块的列表:

ls `npm root -g`


#5楼

This works pretty well too: npm list -g --depth=0 这也很好用: npm list -g --depth=0

  • npm : the Node package manager command line tool npm :Node包管理器命令行工具
  • list -g : display a tree of every package found in the user's folders (without the -g option it only shows the current directory's packages) list -g :显示在用户文件夹中找到的每个包的树(没有-g选项,它只显示当前目录的包)
  • depth 0 / — depth=0 : avoid including every package's dependencies in the tree view depth 0 / - depth = 0 :避免在树视图中包含每个包的依赖关系

#6楼

To see list of all packages that are installed. 查看已安装的所有软件包的列表。

$ npm ls --parseable | awk '{gsub(/\/.*\//,"",$1); print}'| sort -u

show parseable of npm packages list https://docs.npmjs.com/cli/ls#parseable 显示可解析的npm包列表https://docs.npmjs.com/cli/ls#parseable

如何列出npm用户安装的软件包?相关推荐

  1. python所有软件-如何在Python中列出所有已安装的软件包及其版本?

    help('modules'). 在IPython中:In [1]: import #import press-TAB Display all 631 possibilities? (y or n) ...

  2. Linux 使用 yum 查看安装的软件包

    Linux系统下yum命令查看安装了哪些软件包: $yum list installed //列出所有已安装的软件包 yum针对软件包操作常用命令: 1.使用YUM查找软件包  命令:yum sear ...

  3. linux 找到安装的软件包,如何在 Linux 中列出可用的软件包组

    原标题:如何在 Linux 中列出可用的软件包组 编译自: https://www.2daygeek.com/how-to-list-an-available-package-groups-in-li ...

  4. 卸载npm和安装npm_使用`npm uninstall`卸载npm软件包

    卸载npm和安装npm To uninstall a package you have previously installed locally (using npm install <pack ...

  5. linux怎么给所有用户安装软件,Linux安装软件的几种方法

    一.rpm 包安装方式步骤: 1.找到相应的软件包,比如 soft.version.rpm,下载到本机某个目录: 2.打开一个终端,su - 成 root 用户: 3.cd soft.version. ...

  6. Node.js 官网入门教程(二) npm(安装、包版本、卸载、npx)、package.json(scripts、devDependencies)package-lock.json(语义版本规则符号

    Node.js 官网入门教程(二) npm(包管理.安装.包版本.卸载.npx).package.json(scripts.devDependencies).package-lock.json(语义版 ...

  7. Linux下软件安装 非root用户安装软件的一般流程

    Linux下的软件安装 Linux下的软件安装,实质上有如下四种,"正规"程度依次递减: 使用标准的yum/apt/yast包管理程序安装 比如:sudo apt-get inst ...

  8. ubuntu 恢复apt_apt-clone:备份已安装的软件包并在新的 Ubuntu 系统上恢复它们

    如果你需要在少量系统上安装相同的软件包时,apt-clone 会适合你. -- Magesh Maruthamuthu(作者) 当我们在基于 Ubuntu/Debian 的系统上使用 apt-clon ...

  9. nvm、node、npm的安装

    ## 安装nvm.nvm方式安装node.以及npm的安装 1- 下载nvm包到本地,并且解压到c盘下面 2- 使用win+r 输入sysdm.cpl 打开系统属性,选择高级-环境变量-本地用户的环境 ...

最新文章

  1. jspstudy启动mysql失败_MySql启动数据库设置初始密码
  2. Redis的安装及使用
  3. oracle数据库生产,从安装系统到oracle数据库生产环境(centos6.8)搭建
  4. sendRedirec forward
  5. HashMap及ConcurrentHashMap基本原理概述
  6. 判断两个字符串是否相似的函数 AnsiResemblesText 专题研究
  7. 轻量级持久存储系统 MemcacheDB
  8. 38K红外遥控发射与接收电路设计与选型、正向压降、限流电阻、半值角
  9. (原創) 為什麼VB有Dim obj As Foo = New Foo()這種語法? (初級) (Visual BASIC)
  10. Unity2D入门(一):编辑素材、绘制地图
  11. mariadb 卸载 Kali_Adobe官方卸载工具软件安装教程
  12. Win10隐藏语言栏
  13. STM32---IAPISP介绍
  14. Quartus 调试中的Nios 程序
  15. No changes detected报错解决方案
  16. 室内定位——UWB测距及定位原理
  17. python for循环语句1到100_python——循环语句
  18. 西数服务器硬盘区别,桌面硬盘和移动硬盘的区别
  19. maven项目搭建步骤
  20. ElasticSearch - 简介

热门文章

  1. 《iOS 6高级开发手册(第4版)》——1.8节使用加速度移动屏幕上的对象
  2. 《异构信息网络挖掘: 原理和方法》—— 1.3 本书的内容组织
  3. network-monitor
  4. Java Web开发入门 - 第2章 HTTP协议单元作业
  5. https提供安全的web通讯
  6. mysql选择联合索引还是单索引?索引列应该使用哪一个最有效?深入測试探讨...
  7. ip地址二进制转十进制
  8. bzoj4514: [Sdoi2016]数字配对(费用流)
  9. 2.开发Mip组件的第一个demo(点击关闭按钮,关闭外层dom)
  10. mac系统不能使用127.0.0.2的解决方案