How to list npm user-installed packages?

前端 未结 15 2201
后悔当初
后悔当初 2020-12-02 03:09

How do I list the user-installed package ONLY in npm? When I do npm -g list it outputs every package and their dependencies, which is not what I wa

相关标签:
15条回答
  • 2020-12-02 03:42

    You can get a list of all globally installed modules using:

    ls `npm root -g`

    0 讨论(0)
  • 2020-12-02 03:42

    For project dependencies use:

    npm list --depth=0
    

    For global dependencies use:

    npm list -g --depth=0
    
    0 讨论(0)
  • 2020-12-02 03:42

    As a shorthand, you can run:

    npm ls -g --depth=0
    
    0 讨论(0)
  • 2020-12-02 03:47

    You can try NPM Desktop manager

    With just one click, you can install/uninstall packages in dev or global status.

    0 讨论(0)
  • 2020-12-02 03:47

    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

    0 讨论(0)
  • 2020-12-02 03:48

    Node_modules contains user-installed packages so change the directory to node_modules and list the items. Core Modules are defined in node's source in the lib/ folder.

    Example:

         example@example:~/:~/node_modules$ ls
         express  maxmind-native  node-whois  socket.io  ua-parser-js
         geoip    mongoskin       pdfkit      tail       zeromq
         maxmind  nodemailer      request     ua-parser  zmq
    
    0 讨论(0)
提交回复
热议问题