How to uninstall npm packages?

To uninstall a npm package we use the npm uninstall command.

npm uninstall [<@scope>/]<package>[@<version>]

To uninstall a globally installed package we need to use the -g or –global option:

npm uninstall -g [<@scope>/]<package>[@<version>]


npm uninstall --global [<@scope>/]<package>[@<version>]


To remove the uninstalled package from the dependencies in package.json file, use one of the following options with the uninstall command:

  • -S or –save: Remove package from your dependencies list.
  • -D or –save-dev: Remove package from your devDependencies list.
  • -O or –save-optional: Remove from your optionalDependencies list.


For example to remove the package from devDependencies list, you will use:

npm uninstall [<@scope>/]<package>[@<version>] --save-dev


If you use the option “–no-save” with the uninstall command then the package will uninstalled but entry will not be removed from the package.json file.

npm uninstall [<@scope>/]<package>[@<version>] --no-save


The following are aliases of the “uninstall” command: remove, rm, r, un, unlink

So, you can also run the following to uninstall a npm package:

npm remove [<@scope>/]<package>[@<version>]

Leave a Comment

Back to top