NPM: 子パッケージの親を見つけるにはどうすればいいですか? 質問する

NPM: 子パッケージの親を見つけるにはどうすればいいですか? 質問する

古いパッケージが多数あり(Angularjs(1.0)スタックの維持)、インストール時にパッケージの古いバージョンに関する警告が表示されます。

npm WARN deprecated [email protected]: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/
blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated [email protected]: ��  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm

どのパッケージがこれらをプルしているかを調べるにはどうすればいいですか?

npm outdated何も返しません。npm prune何も削除しません。

パッケージ.json

{                                                           
  "devDependencies": {                                                          
    "babel-preset-env": "^1.6.1",                                                          
    "browser-sync-webpack-plugin": "^2.2.2",                                                          
    "copy-webpack-plugin": "^4.5.1",                                                          
    "html-webpack-plugin": "^3.1.0",                                                          
    "css-loader": "^0.28.11",                                                          
    "file-loader": "^1.1.11",                                                          
    "pug-html-loader": "^1.1.5",                                                          
    "pug-loader": "^2.3.0",                                                          
    "graceful-fs": "^4.1.11",                                                          
    "minimatch": "^3.0.4",                                                          
    "node-sass": "^4.8.3",                                                          
    "sass-loader": "^6.0.7",                                                          
    "style-loader": "^0.20.3",                                                          
    "uglifyjs-webpack-plugin": "^1.2.4",                                                          
    "webpack": "^4.3.0",                                                          
    "webpack-cli": "^2.0.13",                                                          
    "webpack-merge": "^4.1.2"                                                          
  },                                                    
  "dependencies": {                                                          
    "@uirouter/angularjs": "latest",
    "ajv": "^6.3.0",                                                         
    "angular": "^1.6.9",                                                          
    "angular-translate": "^2.17.0",                                                          
    "babel-core": "^6.26.0",                                                          
    "babel-loader": "^7.1.4",                                                          
    "babel-plugin-transform-runtime": "^6.23.0",                                                          
    "babel-register": "^6.26.0",                                                          
    "brfs": "^1.5.0",                                                          
    "browser-sync": "^2.23.6",                                                          
    "debowerify": "^1.4.1",                                                          
    "isparta": "^4.0.0",                                                          
    "jshint": "^2.9.5",                                                          
    "jshint-stylish": "^2.2.0",                                                          
    "postcss-loader": "^2.1.3",                                                          
    "pretty-hrtime": "^1.0.2",                                                          
    "pug": "^2.0.3",                                                          
    "tiny-lr": "^1.1.1"                                                          
  }                                                         
}  

ベストアンサー1

できますnpm ls --all。依存関係がどのように組み合わされているかを示すツリー構造が表示されます。以下に例を示します。

lms@nuc ~/src/ralphtheninja/slump (master)
$ npm ls --all                            
[email protected] /home/lms/src/ralphtheninja/slump
├─┬ [email protected]                 
│ └─┬ [email protected]                   
│   └── [email protected] deduped       
├── [email protected]             
├─┬ [email protected]              
│ ├── [email protected]                  
│ ├── [email protected]                    
│ ├── [email protected]                      
│ ├── [email protected]                      
│ ├─┬ [email protected]
│ │ ├── [email protected] deduped
│ │ └─┬ [email protected]
│ │   ├── [email protected] deduped
│ │   ├── [email protected] deduped
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected] deduped
│ │ ├── [email protected] deduped
│ │ ├── [email protected]
│ │ ├── [email protected] deduped
│ │ └── [email protected] deduped
│ └─┬ [email protected]
│   ├── [email protected] deduped
│   └─┬ [email protected]
│     └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]

特定のパッケージについて知りたい場合は、 を実行するnpm ls <package>と、そのサブツリーが表示されます。

json 形式の出力を取得することもできますnpm ls --json。プログラムで分析する場合に便利です。

編集: 元の投稿では を使用することが提案されていましnpm lsたが、 の新しいバージョンではnpm lsフラット リストのみが表示されます。

おすすめ記事