1 ---
2 title: Uninstalling packages and dependencies
3 redirect_from:
4 - /getting-started/uninstalling-local-packages
5 - /getting-started/uninstalling-global-packages
6 ---
7
8 If you no longer need to use a package in your code, we recommend uninstalling it and removing it from your project's dependencies.
9
10 ## Uninstalling local packages
11
12 ### Removing a local package from your node_modules directory
13
14 To remove a package from your node_modules directory, on the command line, use the [`uninstall` command][cli-uninstall]. Include the scope if the package is scoped.
15
16 This uninstalls a package, completely removing everything npm installed on its behalf.
17
18 It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json.
19
20 Further, if you have an npm-shrinkwrap.json or package-lock.json, npm will update those files as well.
21
22 #### Unscoped package
23
24 ```
25 npm uninstall <package_name>
26
27 ```
28
29 #### Scoped package
30
31 ```
32 npm uninstall <@scope/package_name>
33 ```
34
35 ### Example
36
37 ```
38 npm uninstall lodash
39 ```
40
41 ### Removing a local package without removing it from package.json
42
43 Using the `--no-save` will tell npm not to remove the package from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files.
44
45 ### Example
46
47 ```
48 npm uninstall --no-save lodash
49 ```
50
51 <Note>
52
53 `--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.
54
55 </Note>
56
57 ### Confirming local package uninstallation
58
59 To confirm that `npm uninstall` worked correctly, check that the `node_modules` directory no longer contains a directory for the uninstalled package(s).
60
61 - Unix system (such as OSX): `ls node_modules`
62 - Windows systems: `dir node_modules`
63
64 ## Uninstalling global packages
65
66 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.
67
68 ### Unscoped package
69
70 ```
71 npm uninstall -g <package_name>
72 ```
73
74 ### Scoped package
75
76 ```
77 npm uninstall -g <@scope/package_name>
78 ```
79
80 ### Example
81
82 For example, to uninstall a package called `jshint`, run:
83
84 ```
85 npm uninstall -g jshint
86 ```
87
88 ## Resources
89
90 ### Uninstalling local packages
91
92 <YouTube id="Z-BpYj6cSoQ" />
93
94 ### Uninstalling global packages
95
96 <YouTube id="XbvjZxUZJGg" />
97
98 [cli-uninstall]: /cli/uninstall