0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

インストールされているnpm moduleを確認するために使うコマンドたち

Posted at

npm-ls | npm Documentation

global に install されてるのなんだっけ

$ npm ls -g --depth=0
/usr/local/lib
├── npm@6.9.0
└── yarn@1.13.0

--depth の数値をあげてくとその module の依存関係を参照できるけど知りたい人あんまりいなさそうだし使わなさそう

JSON でほしい

$ npm ls -g --depth=0 --json=true
{
  "dependencies": {
    "npm": {
      "version": "6.9.0",
      "from": "npm",
      "resolved": "https://registry.npmjs.org/npm/-/npm-6.9.0.tgz"
    },
    "yarn": {
      "version": "1.13.0",
      "from": "yarn@1.13.0",
      "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.13.0.tgz"
    }
  }
}

package-lock.json っぽい情報を JSON で表示してくれる

dev だけ見たい

$ npm ls --depth=0 --dev
~ ~ ~
├── @babel/core@7.2.2
├── babel-loader@8.0.5
├── webpack@4.29.0
└── webpack-cli@3.2.1

prod だけ見たい

$ npm ls --depth=0 --prod
~ ~ ~
├── react@16.7.0
└── react-dom@16.7.0
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?