Bootstrap FreeKB - NodeJS - List installed packages using the npm list command
NodeJS - List installed packages using the npm list command

Updated:   |  NodeJS articles

The npm list command can be used to list the currently installed packages in the present working directory. If no packages are installed in the present working directory, something like this should be returned.

~]# npm list
/root
 (empty)

 

Let's install a package, Sails in this example.

npm install sails

 

This should create two files and a directory in the present working directory.

~]# ls --long
drwxr-xr-x  171 root root   8192 Aug  6 22:28 node_modules
-rw-r--r--    1 root root     50 Aug  6 22:28 package.json
-rw-r--r--    1 root root 147873 Aug  6 22:28 package-lock.json

 

And now npm list should show that Sails is an installed package in the present working directory.

~]# npm list
root@ /root
 sails@1.4.4

 

The npm list --global command can be used to list packages that were installed using the --global flag. Notice in this example that global packages are found at /usr/nodejs/lib.

~]# npm list --global
/usr/nodejs/lib
 npm@7.20.3
 sails@1.4.4

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 9adeca in the box below so that we can be sure you are a human.