Node.js:npmでバージョンが古くなっているパッケージを確認する方法

スポンサーリンク

npmでバージョンが古くなっているパッケージを確認する方法

npmでバージョンが古くなっているパッケージを確認するにはnpm outdatedコマンドを使用します。

赤色黄色の違いは下記のとおりです。

  • Red means there's a newer version matching your semver requirements, so you should update now.
  • Yellow indicates that there's a newer version above your semver requirements (usually new major, or new 0.x minor) so proceed with caution.

 

$ npm outdated  # バージョンが古くなっているパッケージを表示
Package       Current    Wanted   Latest  Location                  Depended by
@types/node  16.11.21  16.11.21  17.0.12  node_modules/@types/node  my-react-app
react          16.9.0   16.14.0   17.0.2  node_modules/react        my-react-app

$ npm install react@latest  # reactの最新版をインストール

$ npm outdated  # reactについての表示は消える
Package       Current    Wanted   Latest  Location                  Depended by
@types/node  16.11.21  16.11.21  17.0.12  node_modules/@types/node  my-react-app

npm-outdated