# Fix Vite Permission Denied Error When Running Vite.js

> Resolve the Vite permission denied error by changing node_modules ownership back to your user with chown, which happens after running sudo npm install

**URL:** https://sentry.io/answers/how-do-i-fix-the-error-vite-permission-denied-when-running-vite-js/

---

## The Problem

You might get the error `vite: Permission denied` when running `vite`, `vite build`, or an npm script from your `package.json` file, like `npm run build` that ultimately calls `vite`. This error occurs because your user does not have permissions to access the `node_modules` folder.

The most common cause of this error is that you ran `sudo npm install` instead of `npm install`. In this case, your `node_modules` is now owned by the `root` user and your user does not have permission to access the folder.

## The Solution

The solution to this problem is to change the owner of `node_modules` and all its subfolders to your user. Assuming your username is `me`, the command to do this is:

```shell
sudo chown -R me ./node_modules
```

---

*Source: [sentry.io/answers/how-do-i-fix-the-error-vite-permission-denied-when-running-vite-js/](https://sentry.io/answers/how-do-i-fix-the-error-vite-permission-denied-when-running-vite-js/)*
