How to list npm user-installed packages?

前端 未结 15 2277
后悔当初
后悔当初 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:56

    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

提交回复
热议问题