1 ---
2 title: Resolving EACCES permissions errors when installing packages globally
3 redirect_from:
4 - /getting-started/fixing-npm-permissions
5 ---
6
7 If you see an `EACCES` error when you try to [install a package globally][global-install], you can either:
8
9 - Reinstall npm with a node version manager (recommended),
10
11 **or**
12
13 - Manually change npm's default directory
14
15 ## Reinstall npm with a node version manager
16
17 This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in "[Downloading and installing Node.js and npm][install-npm]". You do not need to remove your current version of npm or Node.js before installing a node version manager.
18
19 ## Manually change npm's default directory
20
21 <Note>
22
23 **Note:** This section does not apply to Microsoft Windows.
24
25 </Note>
26
27 To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use a hidden directory in your home directory.
28
29 1. Configure npm to use the new directory path:
30
31 ```
32 npm config set prefix ~/.local
33 ```
34
35 2. In your preferred text editor, open or create a `~/.profile` file and add this line:
36
37 ```
38 PATH=~/.local/bin:$PATH
39 ```
40
41 If you are using zsh (which you can find out by running `echo $0`), you will also need to add this line to `~/.zprofile`:
42
43 ```
44 source ~/.profile
45 ```
46
47 3. On the command line, update your system variables:
48
49 ```
50 source ~/.profile
51 ```
52
53 4. To test your new configuration, install a package globally without using `sudo`:
54
55 ```
56 npm install -g npm-check-updates
57 ```
58
59 And run it:
60
61 ```
62 ncu -g
63 ```
64
65 <Note>
66
67 **npx: an alternative to running global commands**
68
69 If you are using npm version 5.2 or greater, you may want to consider [npx](https://docs.npmjs.com/cli/commands/npx) as an alternative way to run global commands, especially if you only need a command occasionally. For more information, see [this article about npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b).
70
71 </Note>
72
73 [global-install]: downloading-and-installing-packages-globally
74 [install-npm]: downloading-and-installing-node-js-and-npm
75 [npx]: https://www.npmjs.com/package/npx
76 [npx-article]: https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b