• npm list for local packages
  • npm list -g for globally installed packages.

您可以通过传递特定package的name作为参数来查找其版本。 例如, npm list grunt will result in:

[email protected]n /path/to/project/folder
└── [email protected]

Alternatively, you can just run npm list without passing a package name as an argument to see the versions of all your packages:

├─┬ [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
└── [email protected]

You can also add --depth=0 argument to list installed packages without their dependencies.

Find the version of an installed npm package