Uninstalling packages globally via npm in JavaScript

To uninstall libraries installed globally, use the uninstall command with the -g flag:

npm uninstall -g somelib

Depending on how you installed NodeJS, you may need to write sudo before a command (usually for Linux):

sudo npm uninstall -g somelib

Let's uninstall the previously installed sloc utility:

npm uninstall -g sloc

Uninstall the previously installed globally library cowsay.

enru