# NPM: How to Prevent Permissions Errors
This section does not apply to Microsoft Windows. This chapter will be updated to address Windows in the near future.
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, it will be a hidden directory on your home folder.
Back-up your computer before you start.
Make a directory for global installations:
```bash
mkdir ~/.npm-global
```
Configure npm to use the new directory path:
```bash
npm config set prefix '~/.npm-global'
```
Open or create a `~/.profile` file and add this line:
```bash
export PATH=~/.npm-global/bin:$PATH
```
Back on the command line, update your system variables:
```bash
source ~/.profile
```
Test: Download a package globally without using sudo.
```bash
npm install -g jshint
```
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don't want to modify `~/.profile`):
```bash
NPM_CONFIG_PREFIX=~/.npm-global
```
source: https://docs.npmjs.com/getting-started/fixing-npm-permissions