Posted on May 26, 2022
Reading time: 2 minutes Once you installed Node.js on your computer, you can check the version of npm that was bundled with it. The command to check your npm version is The output above means npm has been installed successfully on your computer. Next, let’s see how you find the version of an installed npm package. The version of npm packages installed on your computer can be found by running the First, navigate to the root directory of your project, then run the You should see the output below in your terminal: The output above shows the packages installed in the If you’re using an older npm version, then you might see the list of all modules installed, including the dependencies of your top-level modules. For example, here’s the output when I run The output above also shows the dependency packages installed for your modules, such as To make npm show only the top-level modules, add the In the latest npm version, To check the version of globally installed npm packages, run the Here’s an example: For older npm versions, you might want to add And that’s how you check the versions of globally installed npm packages.npm -v
or npm --version
. Type it in your terminal and you should see the following output:$ npm -v8.1.0# or$ npm --version8.1.0
Find the version of an installed npm package
npm list
command.npm list
command.$ npm list[emailprotected] /Users/nsebhastian/Desktop/DEV/n-app├── [emailprotected]├── [emailprotected]├── [emailprotected]├── [emailprotected]├── [emailprotected]└── [emailprotected]
node_modules/
folder.npm list
using npm v6:$ npm list[emailprotected] /Users/nsebhastian/Desktop/DEV/n-app├─┬ [emailprotected]│ ├── [emailprotected]│ └── [emailprotected]├─┬ [emailprotected]│ ├─┬ [emailprotected]│ │ ├─┬ [emailprotected]│ │ │ └── [emailprotected]│ │ └── [emailprotected]│ ├── [emailprotected]# ...
object-assign
and vary
installed as dependencies of the cors
package.--depth=0
option to the npm list
command:$ npm list --depth=0[emailprotected] /Users/nsebhastian/Desktop/DEV/n-app├── [emailprotected]├── [emailprotected]├── [emailprotected]├── [emailprotected]├── [emailprotected]└── [emailprotected]
--depth=0
is the default option automatically added to the command, so you don’t need to add it anymore.Check the version of globally installed npm packages
npm list
command with the -g
or --global
option added.$ npm list -g/Users/nsebhastian/node/lib├── [emailprotected]└── [emailprotected]
--depth=0
option to show only top-level modules:npm list -g --depth=0/Users/nsebhastian/node/lib├── [emailprotected]└── [emailprotected]