If you no longer need to use a package in your code, we recommend uninstalling it and removing it from your project's dependencies.
Uninstalling local packages Removing a local package from your node_modules directoryTo remove a package from your node_modules directory, on the command line, use the uninstall
command. Include the scope if the package is scoped.
This uninstalls a package, completely removing everything npm installed on its behalf.
It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json.
Further, if you have an npm-shrinkwrap.json or package-lock.json, npm will update those files as well.
Unscoped packagenpm uninstall <package_name>
Scoped package npm uninstall <@scope/package_name>
Example npm uninstall lodash
Removing a local package without removing it from package.json
Using the --no-save
will tell npm not to remove the package from your package.json
, npm-shrinkwrap.json
, or package-lock.json
files.
npm uninstall --no-save lodash
--save
or -S
will tell npm to remove the package from your package.json
, npm-shrinkwrap.json
, and package-lock.json
files. This is the default, but you may need to use this if you have for instance save=false
in your .npmrc
file.
To confirm that npm uninstall
worked correctly, check that the node_modules
directory no longer contains a directory for the uninstalled package(s).
ls node_modules
dir node_modules
To uninstall an unscoped global package, on the command line, use the uninstall
command with the -g
flag. Include the scope if the package is scoped.
npm uninstall -g <package_name>
Scoped package npm uninstall -g <@scope/package_name>
Example
For example, to uninstall a package called jshint
, run:
npm uninstall -g jshint
Resources Uninstalling local packages Uninstalling global packages
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4