1 ---
2 title: Updating packages downloaded from the registry
3 redirect_from:
4 - /getting-started/updating-local-packages
5 - /getting-started/updating-global-packages
6 ---
7
8 Updating local and global packages you downloaded from the registry helps keep your code and tools stable, usable, and secure.
9
10 ## Updating local packages
11
12 We recommend regularly updating the local packages your project depends on to improve your code as improvements to its dependencies are made.
13
14 1. Navigate to the root directory of your project and ensure it contains a `package.json` file:
15
16 ```
17 cd /path/to/project
18 ```
19
20 2. In your project root directory, run the [`update` command][npm-update]:
21
22 ```
23 npm update
24 ```
25
26 3. To test the update, run the [`outdated` command][npm-outdated]. There should not be any output.
27
28 ```
29 npm outdated
30 ```
31
32 ## Updating globally-installed packages
33
34 <Note>
35
36 **Note:** If you are using npm version 2.6.0 or less, run [this script](https://gist.github.com/othiym23/4ac31155da23962afd0e) to update all outdated global packages.
37
38 However, please consider upgrading to the latest version of npm:
39
40 ```
41 npm install npm@latest -g
42 ```
43
44 </Note>
45
46 ### Determining which global packages need updating
47
48 To see which global packages need to be updated, on the command line, run:
49
50 ```
51 npm outdated -g --depth=0
52 ```
53
54 ### Updating a single global package
55
56 To update a single global package, on the command line, run:
57
58 ```
59 npm update -g <package_name>
60 ```
61
62 ### Updating all globally-installed packages
63
64 To update all global packages, on the command line, run:
65
66 ```
67 npm update -g
68 ```
69
70 ## Resources
71
72 <YouTube id="HRudtPGcOt4" />
73
74 ### CLI commands
75
76 - [npm-update](/cli/update)
77 - [npm-outdated](/cli/outdated)
78
79 [npm-update]: /cli/update
80 [npm-outdated]: /cli/outdated