カテゴリー
SugiBlog Webエンジニアのためのお役立ちTips

React.js バージョンの確認方法

プロジェクトのディレクトリにて次のようなコマンドを入力すると各パッケージのバージョンが確認できます。

npm list

出力結果の例

(プロジェクト名)@0.0.0 (プロジェクトのパス)
├── @emotion/react@11.11.4
├── @emotion/styled@11.11.5
├── @fontsource/roboto@5.0.13
├── @mui/icons-material@5.15.20
├── @mui/material@5.15.20
├── @types/react-dom@18.3.0
├── @types/react@18.3.3
├── @vitejs/plugin-react@4.3.1
├── axios@1.7.2
├── eslint-plugin-react-hooks@4.6.2
├── eslint-plugin-react-refresh@0.4.7
├── eslint-plugin-react@7.34.2
├── eslint@8.57.0
├── react-dom@18.3.1
├── react-router-dom@6.24.1
├── react@18.3.1
└── vite@5.3.1

特定のパッケージのバージョンが知りたい場合は次のようにしてください。

npm list react --depth=0

出力結果の例

(プロジェクト名)@0.0.0 (プロジェクトのパス)
└── react@18.3.1

--depth=0を付けないと依存関係にあるパッケージの情報も全て出力されます。

(プロジェクト名)@0.0.0 (プロジェクトのパス)
├─┬ @emotion/react@11.11.4
│ ├─┬ @emotion/use-insertion-effect-with-fallbacks@1.0.1
│ │ └── react@18.3.1 deduped
│ └── react@18.3.1 deduped
├─┬ @emotion/styled@11.11.5
│ └── react@18.3.1 deduped
├─┬ @mui/icons-material@5.15.20
│ └── react@18.3.1 deduped
├─┬ @mui/material@5.15.20
│ ├─┬ @mui/base@5.0.0-beta.40
│ │ ├─┬ @floating-ui/react-dom@2.1.0
│ │ │ └── react@18.3.1 deduped
│ │ └── react@18.3.1 deduped
│ ├─┬ @mui/system@5.15.20
│ │ ├─┬ @mui/private-theming@5.15.20
│ │ │ └── react@18.3.1 deduped
│ │ ├─┬ @mui/styled-engine@5.15.14
│ │ │ └── react@18.3.1 deduped
│ │ └── react@18.3.1 deduped
│ ├─┬ @mui/utils@5.15.20
│ │ └── react@18.3.1 deduped
│ ├─┬ react-transition-group@4.4.5
│ │ └── react@18.3.1 deduped
│ └── react@18.3.1 deduped
├─┬ react-dom@18.3.1
│ └── react@18.3.1 deduped
├─┬ react-router-dom@6.24.1
│ ├─┬ react-router@6.24.1
│ │ └── react@18.3.1 deduped
│ └── react@18.3.1 deduped
└── react@18.3.1
105 views