Sentry Answers>Node.js>

How do I fix the error "Vite: Permission denied" when running Vite.js?

How do I fix the error "Vite: Permission denied" when running Vite.js?

Richard C.

The ProblemJump To Solution

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:

Click to Copy
sudo chown -R me ./node_modules
  • Community SeriesIdentify, Trace, and Fix Endpoint Regression Issues
  • ResourcesBackend Error Monitoring 101
  • Syntax.fm logo
    Listen to the Syntax Podcast

    Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.

    SEE EPISODES

Loved by over 4 million developers and more than 90,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.

© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.